Class StandardToStringStyle

  • All Implemented Interfaces:
    Serializable

    public class StandardToStringStyle
    extends ToStringStyle

    Works with ToStringBuilder to create a toString.

    This class is intended to be used as a singleton. There is no need to instantiate a new style each time. Simply instantiate the class once, customize the values as required, and store the result in a public static final variable for the rest of the program to access.

    Since:
    1.0
    Version:
    $Id: StandardToStringStyle.java 905636 2010-02-02 14:03:32Z niallp $
    See Also:
    Serialized Form
    • Constructor Detail

      • StandardToStringStyle

        public StandardToStringStyle()

        Constructor.

    • Method Detail

      • isUseClassName

        public boolean isUseClassName()

        Gets whether to use the class name.

        Overrides:
        isUseClassName in class ToStringStyle
        Returns:
        the current useClassName flag
      • setUseClassName

        public void setUseClassName​(boolean useClassName)

        Sets whether to use the class name.

        Overrides:
        setUseClassName in class ToStringStyle
        Parameters:
        useClassName - the new useClassName flag
      • isUseShortClassName

        public boolean isUseShortClassName()

        Gets whether to output short or long class names.

        Overrides:
        isUseShortClassName in class ToStringStyle
        Returns:
        the current useShortClassName flag
        Since:
        2.0
      • isShortClassName

        public boolean isShortClassName()
        Deprecated.
        Use isUseShortClassName() Method will be removed in Commons Lang 3.0.

        Gets whether to output short or long class names.

        Overrides:
        isShortClassName in class ToStringStyle
        Returns:
        the current shortClassName flag
      • setUseShortClassName

        public void setUseShortClassName​(boolean useShortClassName)

        Sets whether to output short or long class names.

        Overrides:
        setUseShortClassName in class ToStringStyle
        Parameters:
        useShortClassName - the new useShortClassName flag
        Since:
        2.0
      • setShortClassName

        public void setShortClassName​(boolean shortClassName)
        Deprecated.
        Use setUseShortClassName(boolean) Method will be removed in Commons Lang 3.0.

        Sets whether to output short or long class names.

        Overrides:
        setShortClassName in class ToStringStyle
        Parameters:
        shortClassName - the new shortClassName flag
      • isUseIdentityHashCode

        public boolean isUseIdentityHashCode()

        Gets whether to use the identity hash code.

        Overrides:
        isUseIdentityHashCode in class ToStringStyle
        Returns:
        the current useIdentityHashCode flag
      • setUseIdentityHashCode

        public void setUseIdentityHashCode​(boolean useIdentityHashCode)

        Sets whether to use the identity hash code.

        Overrides:
        setUseIdentityHashCode in class ToStringStyle
        Parameters:
        useIdentityHashCode - the new useIdentityHashCode flag
      • isUseFieldNames

        public boolean isUseFieldNames()

        Gets whether to use the field names passed in.

        Overrides:
        isUseFieldNames in class ToStringStyle
        Returns:
        the current useFieldNames flag
      • setUseFieldNames

        public void setUseFieldNames​(boolean useFieldNames)

        Sets whether to use the field names passed in.

        Overrides:
        setUseFieldNames in class ToStringStyle
        Parameters:
        useFieldNames - the new useFieldNames flag
      • isDefaultFullDetail

        public boolean isDefaultFullDetail()

        Gets whether to use full detail when the caller doesn't specify.

        Overrides:
        isDefaultFullDetail in class ToStringStyle
        Returns:
        the current defaultFullDetail flag
      • setDefaultFullDetail

        public void setDefaultFullDetail​(boolean defaultFullDetail)

        Sets whether to use full detail when the caller doesn't specify.

        Overrides:
        setDefaultFullDetail in class ToStringStyle
        Parameters:
        defaultFullDetail - the new defaultFullDetail flag
      • isArrayContentDetail

        public boolean isArrayContentDetail()

        Gets whether to output array content detail.

        Overrides:
        isArrayContentDetail in class ToStringStyle
        Returns:
        the current array content detail setting
      • setArrayContentDetail

        public void setArrayContentDetail​(boolean arrayContentDetail)

        Sets whether to output array content detail.

        Overrides:
        setArrayContentDetail in class ToStringStyle
        Parameters:
        arrayContentDetail - the new arrayContentDetail flag
      • getArrayStart

        public String getArrayStart()

        Gets the array start text.

        Overrides:
        getArrayStart in class ToStringStyle
        Returns:
        the current array start text
      • setArrayStart

        public void setArrayStart​(String arrayStart)

        Sets the array start text.

        null is accepted, but will be converted to an empty String.

        Overrides:
        setArrayStart in class ToStringStyle
        Parameters:
        arrayStart - the new array start text
      • getArrayEnd

        public String getArrayEnd()

        Gets the array end text.

        Overrides:
        getArrayEnd in class ToStringStyle
        Returns:
        the current array end text
      • setArrayEnd

        public void setArrayEnd​(String arrayEnd)

        Sets the array end text.

        null is accepted, but will be converted to an empty String.

        Overrides:
        setArrayEnd in class ToStringStyle
        Parameters:
        arrayEnd - the new array end text
      • getArraySeparator

        public String getArraySeparator()

        Gets the array separator text.

        Overrides:
        getArraySeparator in class ToStringStyle
        Returns:
        the current array separator text
      • setArraySeparator

        public void setArraySeparator​(String arraySeparator)

        Sets the array separator text.

        null is accepted, but will be converted to an empty String.

        Overrides:
        setArraySeparator in class ToStringStyle
        Parameters:
        arraySeparator - the new array separator text
      • getContentStart

        public String getContentStart()

        Gets the content start text.

        Overrides:
        getContentStart in class ToStringStyle
        Returns:
        the current content start text
      • setContentStart

        public void setContentStart​(String contentStart)

        Sets the content start text.

        null is accepted, but will be converted to an empty String.

        Overrides:
        setContentStart in class ToStringStyle
        Parameters:
        contentStart - the new content start text
      • getContentEnd

        public String getContentEnd()

        Gets the content end text.

        Overrides:
        getContentEnd in class ToStringStyle
        Returns:
        the current content end text
      • setContentEnd

        public void setContentEnd​(String contentEnd)

        Sets the content end text.

        null is accepted, but will be converted to an empty String.

        Overrides:
        setContentEnd in class ToStringStyle
        Parameters:
        contentEnd - the new content end text
      • getFieldNameValueSeparator

        public String getFieldNameValueSeparator()

        Gets the field name value separator text.

        Overrides:
        getFieldNameValueSeparator in class ToStringStyle
        Returns:
        the current field name value separator text
      • setFieldNameValueSeparator

        public void setFieldNameValueSeparator​(String fieldNameValueSeparator)

        Sets the field name value separator text.

        null is accepted, but will be converted to an empty String.

        Overrides:
        setFieldNameValueSeparator in class ToStringStyle
        Parameters:
        fieldNameValueSeparator - the new field name value separator text
      • getFieldSeparator

        public String getFieldSeparator()

        Gets the field separator text.

        Overrides:
        getFieldSeparator in class ToStringStyle
        Returns:
        the current field separator text
      • setFieldSeparator

        public void setFieldSeparator​(String fieldSeparator)

        Sets the field separator text.

        null is accepted, but will be converted to an empty String.

        Overrides:
        setFieldSeparator in class ToStringStyle
        Parameters:
        fieldSeparator - the new field separator text
      • isFieldSeparatorAtStart

        public boolean isFieldSeparatorAtStart()

        Gets whether the field separator should be added at the start of each buffer.

        Overrides:
        isFieldSeparatorAtStart in class ToStringStyle
        Returns:
        the fieldSeparatorAtStart flag
        Since:
        2.0
      • setFieldSeparatorAtStart

        public void setFieldSeparatorAtStart​(boolean fieldSeparatorAtStart)

        Sets whether the field separator should be added at the start of each buffer.

        Overrides:
        setFieldSeparatorAtStart in class ToStringStyle
        Parameters:
        fieldSeparatorAtStart - the fieldSeparatorAtStart flag
        Since:
        2.0
      • isFieldSeparatorAtEnd

        public boolean isFieldSeparatorAtEnd()

        Gets whether the field separator should be added at the end of each buffer.

        Overrides:
        isFieldSeparatorAtEnd in class ToStringStyle
        Returns:
        fieldSeparatorAtEnd flag
        Since:
        2.0
      • setFieldSeparatorAtEnd

        public void setFieldSeparatorAtEnd​(boolean fieldSeparatorAtEnd)

        Sets whether the field separator should be added at the end of each buffer.

        Overrides:
        setFieldSeparatorAtEnd in class ToStringStyle
        Parameters:
        fieldSeparatorAtEnd - the fieldSeparatorAtEnd flag
        Since:
        2.0
      • getNullText

        public String getNullText()

        Gets the text to output when null found.

        Overrides:
        getNullText in class ToStringStyle
        Returns:
        the current text to output when null found
      • setNullText

        public void setNullText​(String nullText)

        Sets the text to output when null found.

        null is accepted, but will be converted to an empty String.

        Overrides:
        setNullText in class ToStringStyle
        Parameters:
        nullText - the new text to output when null found
      • getSizeStartText

        public String getSizeStartText()

        Gets the text to output when a Collection, Map or Array size is output.

        This is output before the size value.

        Overrides:
        getSizeStartText in class ToStringStyle
        Returns:
        the current start of size text
      • setSizeStartText

        public void setSizeStartText​(String sizeStartText)

        Sets the start text to output when a Collection, Map or Array size is output.

        This is output before the size value.

        null is accepted, but will be converted to an empty String.

        Overrides:
        setSizeStartText in class ToStringStyle
        Parameters:
        sizeStartText - the new start of size text
      • getSizeEndText

        public String getSizeEndText()
        Gets the end text to output when a Collection, Map or Array size is output.

        This is output after the size value.

        Overrides:
        getSizeEndText in class ToStringStyle
        Returns:
        the current end of size text
      • setSizeEndText

        public void setSizeEndText​(String sizeEndText)

        Sets the end text to output when a Collection, Map or Array size is output.

        This is output after the size value.

        null is accepted, but will be converted to an empty String.

        Overrides:
        setSizeEndText in class ToStringStyle
        Parameters:
        sizeEndText - the new end of size text
      • getSummaryObjectStartText

        public String getSummaryObjectStartText()

        Gets the start text to output when an Object is output in summary mode.

        This is output before the size value.

        Overrides:
        getSummaryObjectStartText in class ToStringStyle
        Returns:
        the current start of summary text
      • setSummaryObjectStartText

        public void setSummaryObjectStartText​(String summaryObjectStartText)

        Sets the start text to output when an Object is output in summary mode.

        This is output before the size value.

        null is accepted, but will be converted to an empty String.

        Overrides:
        setSummaryObjectStartText in class ToStringStyle
        Parameters:
        summaryObjectStartText - the new start of summary text
      • getSummaryObjectEndText

        public String getSummaryObjectEndText()

        Gets the end text to output when an Object is output in summary mode.

        This is output after the size value.

        Overrides:
        getSummaryObjectEndText in class ToStringStyle
        Returns:
        the current end of summary text
      • setSummaryObjectEndText

        public void setSummaryObjectEndText​(String summaryObjectEndText)

        Sets the end text to output when an Object is output in summary mode.

        This is output after the size value.

        null is accepted, but will be converted to an empty String.

        Overrides:
        setSummaryObjectEndText in class ToStringStyle
        Parameters:
        summaryObjectEndText - the new end of summary text