Class ToStringStyle

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ToStringStyle()
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void append​(java.lang.StringBuffer buffer, java.lang.String fieldName, boolean value)
      Append to the toString a boolean value.
      void append​(java.lang.StringBuffer buffer, java.lang.String fieldName, boolean[] array, java.lang.Boolean fullDetail)
      Append to the toString a boolean array.
      void append​(java.lang.StringBuffer buffer, java.lang.String fieldName, byte value)
      Append to the toString a byte value.
      void append​(java.lang.StringBuffer buffer, java.lang.String fieldName, byte[] array, java.lang.Boolean fullDetail)
      Append to the toString a byte array.
      void append​(java.lang.StringBuffer buffer, java.lang.String fieldName, char value)
      Append to the toString a char value.
      void append​(java.lang.StringBuffer buffer, java.lang.String fieldName, char[] array, java.lang.Boolean fullDetail)
      Append to the toString a char array.
      void append​(java.lang.StringBuffer buffer, java.lang.String fieldName, double value)
      Append to the toString a double value.
      void append​(java.lang.StringBuffer buffer, java.lang.String fieldName, double[] array, java.lang.Boolean fullDetail)
      Append to the toString a double array.
      void append​(java.lang.StringBuffer buffer, java.lang.String fieldName, float value)
      Append to the toString a float value.
      void append​(java.lang.StringBuffer buffer, java.lang.String fieldName, float[] array, java.lang.Boolean fullDetail)
      Append to the toString a float array.
      void append​(java.lang.StringBuffer buffer, java.lang.String fieldName, int value)
      Append to the toString an int value.
      void append​(java.lang.StringBuffer buffer, java.lang.String fieldName, int[] array, java.lang.Boolean fullDetail)
      Append to the toString an int array.
      void append​(java.lang.StringBuffer buffer, java.lang.String fieldName, long value)
      Append to the toString a long value.
      void append​(java.lang.StringBuffer buffer, java.lang.String fieldName, long[] array, java.lang.Boolean fullDetail)
      Append to the toString a long array.
      void append​(java.lang.StringBuffer buffer, java.lang.String fieldName, short value)
      Append to the toString a short value.
      void append​(java.lang.StringBuffer buffer, java.lang.String fieldName, short[] array, java.lang.Boolean fullDetail)
      Append to the toString a short array.
      void append​(java.lang.StringBuffer buffer, java.lang.String fieldName, java.lang.Object[] array, java.lang.Boolean fullDetail)
      Append to the toString an Object array.
      void append​(java.lang.StringBuffer buffer, java.lang.String fieldName, java.lang.Object value, java.lang.Boolean fullDetail)
      Append to the toString an Object value, printing the full toString of the Object passed in.
      protected void appendClassName​(java.lang.StringBuffer buffer, java.lang.Object object)
      Append to the toString the class name.
      protected void appendContentEnd​(java.lang.StringBuffer buffer)
      Append to the toString the content end.
      protected void appendContentStart​(java.lang.StringBuffer buffer)
      Append to the toString the content start.
      protected void appendCyclicObject​(java.lang.StringBuffer buffer, java.lang.String fieldName, java.lang.Object value)
      Append to the toString an Object value that has been detected to participate in a cycle.
      protected void appendDetail​(java.lang.StringBuffer buffer, java.lang.String fieldName, boolean value)
      Append to the toString a boolean value.
      protected void appendDetail​(java.lang.StringBuffer buffer, java.lang.String fieldName, boolean[] array)
      Append to the toString the detail of a boolean array.
      protected void appendDetail​(java.lang.StringBuffer buffer, java.lang.String fieldName, byte value)
      Append to the toString a byte value.
      protected void appendDetail​(java.lang.StringBuffer buffer, java.lang.String fieldName, byte[] array)
      Append to the toString the detail of a byte array.
      protected void appendDetail​(java.lang.StringBuffer buffer, java.lang.String fieldName, char value)
      Append to the toString a char value.
      protected void appendDetail​(java.lang.StringBuffer buffer, java.lang.String fieldName, char[] array)
      Append to the toString the detail of a char array.
      protected void appendDetail​(java.lang.StringBuffer buffer, java.lang.String fieldName, double value)
      Append to the toString a double value.
      protected void appendDetail​(java.lang.StringBuffer buffer, java.lang.String fieldName, double[] array)
      Append to the toString the detail of a double array.
      protected void appendDetail​(java.lang.StringBuffer buffer, java.lang.String fieldName, float value)
      Append to the toString a float value.
      protected void appendDetail​(java.lang.StringBuffer buffer, java.lang.String fieldName, float[] array)
      Append to the toString the detail of a float array.
      protected void appendDetail​(java.lang.StringBuffer buffer, java.lang.String fieldName, int value)
      Append to the toString an int value.
      protected void appendDetail​(java.lang.StringBuffer buffer, java.lang.String fieldName, int[] array)
      Append to the toString the detail of an int array.
      protected void appendDetail​(java.lang.StringBuffer buffer, java.lang.String fieldName, int i, java.lang.Object item)
      Append to the toString the detail of an Object array item.
      protected void appendDetail​(java.lang.StringBuffer buffer, java.lang.String fieldName, long value)
      Append to the toString a long value.
      protected void appendDetail​(java.lang.StringBuffer buffer, java.lang.String fieldName, long[] array)
      Append to the toString the detail of a long array.
      protected void appendDetail​(java.lang.StringBuffer buffer, java.lang.String fieldName, short value)
      Append to the toString a short value.
      protected void appendDetail​(java.lang.StringBuffer buffer, java.lang.String fieldName, short[] array)
      Append to the toString the detail of a short array.
      protected void appendDetail​(java.lang.StringBuffer buffer, java.lang.String fieldName, java.lang.Object value)
      Append to the toString an Object value, printing the full detail of the Object.
      protected void appendDetail​(java.lang.StringBuffer buffer, java.lang.String fieldName, java.lang.Object[] array)
      Append to the toString the detail of an Object array.
      protected void appendDetail​(java.lang.StringBuffer buffer, java.lang.String fieldName, java.util.Collection<?> coll)
      Append to the toString a Collection.
      protected void appendDetail​(java.lang.StringBuffer buffer, java.lang.String fieldName, java.util.Map<?,​?> map)
      Append to the toString a Map.
      void appendEnd​(java.lang.StringBuffer buffer, java.lang.Object object)
      Append to the toString the end of data indicator.
      protected void appendFieldEnd​(java.lang.StringBuffer buffer, java.lang.String fieldName)
      Append to the toString the field end.
      protected void appendFieldSeparator​(java.lang.StringBuffer buffer)
      Append to the toString the field separator.
      protected void appendFieldStart​(java.lang.StringBuffer buffer, java.lang.String fieldName)
      Append to the toString the field start.
      protected void appendIdentityHashCode​(java.lang.StringBuffer buffer, java.lang.Object object)
      Append the System.identityHashCode(java.lang.Object).
      protected void appendInternal​(java.lang.StringBuffer buffer, java.lang.String fieldName, java.lang.Object value, boolean detail)
      Append to the toString an Object, correctly interpreting its type.
      protected void appendNullText​(java.lang.StringBuffer buffer, java.lang.String fieldName)
      Append to the toString an indicator for null.
      void appendStart​(java.lang.StringBuffer buffer, java.lang.Object object)
      Append to the toString the start of data indicator.
      protected void appendSummary​(java.lang.StringBuffer buffer, java.lang.String fieldName, boolean[] array)
      Append to the toString a summary of a boolean array.
      protected void appendSummary​(java.lang.StringBuffer buffer, java.lang.String fieldName, byte[] array)
      Append to the toString a summary of a byte array.
      protected void appendSummary​(java.lang.StringBuffer buffer, java.lang.String fieldName, char[] array)
      Append to the toString a summary of a char array.
      protected void appendSummary​(java.lang.StringBuffer buffer, java.lang.String fieldName, double[] array)
      Append to the toString a summary of a double array.
      protected void appendSummary​(java.lang.StringBuffer buffer, java.lang.String fieldName, float[] array)
      Append to the toString a summary of a float array.
      protected void appendSummary​(java.lang.StringBuffer buffer, java.lang.String fieldName, int[] array)
      Append to the toString a summary of an int array.
      protected void appendSummary​(java.lang.StringBuffer buffer, java.lang.String fieldName, long[] array)
      Append to the toString a summary of a long array.
      protected void appendSummary​(java.lang.StringBuffer buffer, java.lang.String fieldName, short[] array)
      Append to the toString a summary of a short array.
      protected void appendSummary​(java.lang.StringBuffer buffer, java.lang.String fieldName, java.lang.Object value)
      Append to the toString an Object value, printing a summary of the Object.
      protected void appendSummary​(java.lang.StringBuffer buffer, java.lang.String fieldName, java.lang.Object[] array)
      Append to the toString a summary of an Object array.
      protected void appendSummarySize​(java.lang.StringBuffer buffer, java.lang.String fieldName, int size)
      Append to the toString a size summary.
      void appendSuper​(java.lang.StringBuffer buffer, java.lang.String superToString)
      Append to the toString the superclass toString.
      void appendToString​(java.lang.StringBuffer buffer, java.lang.String toString)
      Append to the toString another toString.
      protected java.lang.String getArrayEnd()
      Gets the array end text.
      protected java.lang.String getArraySeparator()
      Gets the array separator text.
      protected java.lang.String getArrayStart()
      Gets the array start text.
      protected java.lang.String getContentEnd()
      Gets the content end text.
      protected java.lang.String getContentStart()
      Gets the content start text.
      protected java.lang.String getFieldNameValueSeparator()
      Gets the field name value separator text.
      protected java.lang.String getFieldSeparator()
      Gets the field separator text.
      protected java.lang.String getNullText()
      Gets the text to output when null found.
      (package private) static java.util.Map<java.lang.Object,​java.lang.Object> getRegistry()
      Returns the registry of objects being traversed by the reflectionToString methods in the current thread.
      protected java.lang.String getShortClassName​(java.lang.Class<?> cls)
      Gets the short class name for a class.
      protected java.lang.String getSizeEndText()
      Gets the end text to output when a Collection, Map or array size is output.
      protected java.lang.String getSizeStartText()
      Gets the start text to output when a Collection, Map or array size is output.
      protected java.lang.String getSummaryObjectEndText()
      Gets the end text to output when an Object is output in summary mode.
      protected java.lang.String getSummaryObjectStartText()
      Gets the start text to output when an Object is output in summary mode.
      protected boolean isArrayContentDetail()
      Gets whether to output array content detail.
      protected boolean isDefaultFullDetail()
      Gets whether to use full detail when the caller doesn't specify.
      protected boolean isFieldSeparatorAtEnd()
      Gets whether the field separator should be added at the end of each buffer.
      protected boolean isFieldSeparatorAtStart()
      Gets whether the field separator should be added at the start of each buffer.
      protected boolean isFullDetail​(java.lang.Boolean fullDetailRequest)
      Is this field to be output in full detail.
      (package private) static boolean isRegistered​(java.lang.Object value)
      Returns true if the registry contains the given object.
      protected boolean isUseClassName()
      Gets whether to use the class name.
      protected boolean isUseFieldNames()
      Gets whether to use the field names passed in.
      protected boolean isUseIdentityHashCode()
      Gets whether to use the identity hash code.
      protected boolean isUseShortClassName()
      Gets whether to output short or long class names.
      protected void reflectionAppendArrayDetail​(java.lang.StringBuffer buffer, java.lang.String fieldName, java.lang.Object array)
      Append to the toString the detail of an array type.
      (package private) static void register​(java.lang.Object value)
      Registers the given object.
      protected void removeLastFieldSeparator​(java.lang.StringBuffer buffer)
      Remove the last field separator from the buffer.
      protected void setArrayContentDetail​(boolean arrayContentDetail)
      Sets whether to output array content detail.
      protected void setArrayEnd​(java.lang.String arrayEnd)
      Sets the array end text.
      protected void setArraySeparator​(java.lang.String arraySeparator)
      Sets the array separator text.
      protected void setArrayStart​(java.lang.String arrayStart)
      Sets the array start text.
      protected void setContentEnd​(java.lang.String contentEnd)
      Sets the content end text.
      protected void setContentStart​(java.lang.String contentStart)
      Sets the content start text.
      protected void setDefaultFullDetail​(boolean defaultFullDetail)
      Sets whether to use full detail when the caller doesn't specify.
      protected void setFieldNameValueSeparator​(java.lang.String fieldNameValueSeparator)
      Sets the field name value separator text.
      protected void setFieldSeparator​(java.lang.String fieldSeparator)
      Sets the field separator text.
      protected void setFieldSeparatorAtEnd​(boolean fieldSeparatorAtEnd)
      Sets whether the field separator should be added at the end of each buffer.
      protected void setFieldSeparatorAtStart​(boolean fieldSeparatorAtStart)
      Sets whether the field separator should be added at the start of each buffer.
      protected void setNullText​(java.lang.String nullText)
      Sets the text to output when null found.
      protected void setSizeEndText​(java.lang.String sizeEndText)
      Sets the end text to output when a Collection, Map or array size is output.
      protected void setSizeStartText​(java.lang.String sizeStartText)
      Sets the start text to output when a Collection, Map or array size is output.
      protected void setSummaryObjectEndText​(java.lang.String summaryObjectEndText)
      Sets the end text to output when an Object is output in summary mode.
      protected void setSummaryObjectStartText​(java.lang.String summaryObjectStartText)
      Sets the start text to output when an Object is output in summary mode.
      protected void setUseClassName​(boolean useClassName)
      Sets whether to use the class name.
      protected void setUseFieldNames​(boolean useFieldNames)
      Sets whether to use the field names passed in.
      protected void setUseIdentityHashCode​(boolean useIdentityHashCode)
      Sets whether to use the identity hash code.
      protected void setUseShortClassName​(boolean useShortClassName)
      Sets whether to output short or long class names.
      (package private) static void unregister​(java.lang.Object value)
      Unregisters the given object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Serialization version ID.
        See Also:
        Constant Field Values
      • DEFAULT_STYLE

        public static final ToStringStyle DEFAULT_STYLE
        The default toString style. Using the Person example from ToStringBuilder, the output would look like this:
         Person@182f0db[name=John Doe,age=33,smoker=false]
         
      • MULTI_LINE_STYLE

        public static final ToStringStyle MULTI_LINE_STYLE
        The multi line toString style. Using the Person example from ToStringBuilder, the output would look like this:
         Person@182f0db[
           name=John Doe
           age=33
           smoker=false
         ]
         
      • NO_FIELD_NAMES_STYLE

        public static final ToStringStyle NO_FIELD_NAMES_STYLE
        The no field names toString style. Using the Person example from ToStringBuilder, the output would look like this:
         Person@182f0db[John Doe,33,false]
         
      • SHORT_PREFIX_STYLE

        public static final ToStringStyle SHORT_PREFIX_STYLE
        The short prefix toString style. Using the Person example from ToStringBuilder, the output would look like this:
         Person[name=John Doe,age=33,smoker=false]
         
        Since:
        2.1
      • SIMPLE_STYLE

        public static final ToStringStyle SIMPLE_STYLE
        The simple toString style. Using the Person example from ToStringBuilder, the output would look like this:
         John Doe,33,false
         
      • NO_CLASS_NAME_STYLE

        public static final ToStringStyle NO_CLASS_NAME_STYLE
        The no class name toString style. Using the Person example from ToStringBuilder, the output would look like this:
         [name=John Doe,age=33,smoker=false]
         
        Since:
        3.4
      • JSON_STYLE

        public static final ToStringStyle JSON_STYLE
        The JSON toString style. Using the Person example from ToStringBuilder, the output would look like this:
         {"name": "John Doe", "age": 33, "smoker": true}
         
        Note: Since field names are mandatory in JSON, this ToStringStyle will throw an UnsupportedOperationException if no field name is passed in while appending. Furthermore This ToStringStyle will only generate valid JSON if referenced objects also produce JSON when calling toString() on them.
        Since:
        3.4
        See Also:
        json.org
      • REGISTRY

        private static final java.lang.ThreadLocal<java.util.WeakHashMap<java.lang.Object,​java.lang.Object>> REGISTRY

        A registry of objects used by reflectionToString methods to detect cyclical object references and avoid infinite loops.

      • useFieldNames

        private boolean useFieldNames
        Whether to use the field names, the default is true.
      • useClassName

        private boolean useClassName
        Whether to use the class name, the default is true.
      • useShortClassName

        private boolean useShortClassName
        Whether to use short class names, the default is false.
      • useIdentityHashCode

        private boolean useIdentityHashCode
        Whether to use the identity hash code, the default is true.
      • contentStart

        private java.lang.String contentStart
        The content start '['.
      • contentEnd

        private java.lang.String contentEnd
        The content end ']'.
      • fieldNameValueSeparator

        private java.lang.String fieldNameValueSeparator
        The field name value separator '='.
      • fieldSeparatorAtStart

        private boolean fieldSeparatorAtStart
        Whether the field separator should be added before any other fields.
      • fieldSeparatorAtEnd

        private boolean fieldSeparatorAtEnd
        Whether the field separator should be added after any other fields.
      • fieldSeparator

        private java.lang.String fieldSeparator
        The field separator ','.
      • arrayStart

        private java.lang.String arrayStart
        The array start '{'.
      • arraySeparator

        private java.lang.String arraySeparator
        The array separator ','.
      • arrayContentDetail

        private boolean arrayContentDetail
        The detail for array content.
      • arrayEnd

        private java.lang.String arrayEnd
        The array end ''}.
      • defaultFullDetail

        private boolean defaultFullDetail
        The value to use when fullDetail is null, the default value is true.
      • nullText

        private java.lang.String nullText
        The null text '&lt;null&gt;'.
      • sizeStartText

        private java.lang.String sizeStartText
        The summary size text start '&lt;size'.
      • sizeEndText

        private java.lang.String sizeEndText
        The summary size text start '&gt;'.
      • summaryObjectStartText

        private java.lang.String summaryObjectStartText
        The summary object text start '&lt;'.
      • summaryObjectEndText

        private java.lang.String summaryObjectEndText
        The summary object text start '&gt;'.
    • Constructor Detail

      • ToStringStyle

        protected ToStringStyle()

        Constructor.

    • Method Detail

      • getRegistry

        static java.util.Map<java.lang.Object,​java.lang.Object> getRegistry()

        Returns the registry of objects being traversed by the reflectionToString methods in the current thread.

        Returns:
        Set the registry of objects being traversed
      • isRegistered

        static boolean isRegistered​(java.lang.Object value)

        Returns true if the registry contains the given object. Used by the reflection methods to avoid infinite loops.

        Parameters:
        value - The object to lookup in the registry.
        Returns:
        boolean true if the registry contains the given object.
      • register

        static void register​(java.lang.Object value)

        Registers the given object. Used by the reflection methods to avoid infinite loops.

        Parameters:
        value - The object to register.
      • unregister

        static void unregister​(java.lang.Object value)

        Unregisters the given object.

        Used by the reflection methods to avoid infinite loops.

        Parameters:
        value - The object to unregister.
      • appendSuper

        public void appendSuper​(java.lang.StringBuffer buffer,
                                java.lang.String superToString)

        Append to the toString the superclass toString.

        NOTE: It assumes that the toString has been created from the same ToStringStyle.

        A null superToString is ignored.

        Parameters:
        buffer - the StringBuffer to populate
        superToString - the super.toString()
        Since:
        2.0
      • appendToString

        public void appendToString​(java.lang.StringBuffer buffer,
                                   java.lang.String toString)

        Append to the toString another toString.

        NOTE: It assumes that the toString has been created from the same ToStringStyle.

        A null toString is ignored.

        Parameters:
        buffer - the StringBuffer to populate
        toString - the additional toString
        Since:
        2.0
      • appendStart

        public void appendStart​(java.lang.StringBuffer buffer,
                                java.lang.Object object)

        Append to the toString the start of data indicator.

        Parameters:
        buffer - the StringBuffer to populate
        object - the Object to build a toString for
      • appendEnd

        public void appendEnd​(java.lang.StringBuffer buffer,
                              java.lang.Object object)

        Append to the toString the end of data indicator.

        Parameters:
        buffer - the StringBuffer to populate
        object - the Object to build a toString for.
      • removeLastFieldSeparator

        protected void removeLastFieldSeparator​(java.lang.StringBuffer buffer)

        Remove the last field separator from the buffer.

        Parameters:
        buffer - the StringBuffer to populate
        Since:
        2.0
      • append

        public void append​(java.lang.StringBuffer buffer,
                           java.lang.String fieldName,
                           java.lang.Object value,
                           java.lang.Boolean fullDetail)

        Append to the toString an Object value, printing the full toString of the Object passed in.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name
        value - the value to add to the toString
        fullDetail - true for detail, false for summary info, null for style decides
      • appendInternal

        protected void appendInternal​(java.lang.StringBuffer buffer,
                                      java.lang.String fieldName,
                                      java.lang.Object value,
                                      boolean detail)

        Append to the toString an Object, correctly interpreting its type.

        This method performs the main lookup by Class type to correctly route arrays, Collections, Maps and Objects to the appropriate method.

        Either detail or summary views can be specified.

        If a cycle is detected, an object will be appended with the Object.toString() format.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        value - the value to add to the toString, not null
        detail - output detail or not
      • appendCyclicObject

        protected void appendCyclicObject​(java.lang.StringBuffer buffer,
                                          java.lang.String fieldName,
                                          java.lang.Object value)

        Append to the toString an Object value that has been detected to participate in a cycle. This implementation will print the standard string value of the value.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        value - the value to add to the toString, not null
        Since:
        2.2
      • appendDetail

        protected void appendDetail​(java.lang.StringBuffer buffer,
                                    java.lang.String fieldName,
                                    java.lang.Object value)

        Append to the toString an Object value, printing the full detail of the Object.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        value - the value to add to the toString, not null
      • appendDetail

        protected void appendDetail​(java.lang.StringBuffer buffer,
                                    java.lang.String fieldName,
                                    java.util.Collection<?> coll)

        Append to the toString a Collection.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        coll - the Collection to add to the toString, not null
      • appendDetail

        protected void appendDetail​(java.lang.StringBuffer buffer,
                                    java.lang.String fieldName,
                                    java.util.Map<?,​?> map)

        Append to the toString a Map.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        map - the Map to add to the toString, not null
      • appendSummary

        protected void appendSummary​(java.lang.StringBuffer buffer,
                                     java.lang.String fieldName,
                                     java.lang.Object value)

        Append to the toString an Object value, printing a summary of the Object.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        value - the value to add to the toString, not null
      • append

        public void append​(java.lang.StringBuffer buffer,
                           java.lang.String fieldName,
                           long value)

        Append to the toString a long value.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name
        value - the value to add to the toString
      • appendDetail

        protected void appendDetail​(java.lang.StringBuffer buffer,
                                    java.lang.String fieldName,
                                    long value)

        Append to the toString a long value.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        value - the value to add to the toString
      • append

        public void append​(java.lang.StringBuffer buffer,
                           java.lang.String fieldName,
                           int value)

        Append to the toString an int value.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name
        value - the value to add to the toString
      • appendDetail

        protected void appendDetail​(java.lang.StringBuffer buffer,
                                    java.lang.String fieldName,
                                    int value)

        Append to the toString an int value.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        value - the value to add to the toString
      • append

        public void append​(java.lang.StringBuffer buffer,
                           java.lang.String fieldName,
                           short value)

        Append to the toString a short value.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name
        value - the value to add to the toString
      • appendDetail

        protected void appendDetail​(java.lang.StringBuffer buffer,
                                    java.lang.String fieldName,
                                    short value)

        Append to the toString a short value.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        value - the value to add to the toString
      • append

        public void append​(java.lang.StringBuffer buffer,
                           java.lang.String fieldName,
                           byte value)

        Append to the toString a byte value.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name
        value - the value to add to the toString
      • appendDetail

        protected void appendDetail​(java.lang.StringBuffer buffer,
                                    java.lang.String fieldName,
                                    byte value)

        Append to the toString a byte value.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        value - the value to add to the toString
      • append

        public void append​(java.lang.StringBuffer buffer,
                           java.lang.String fieldName,
                           char value)

        Append to the toString a char value.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name
        value - the value to add to the toString
      • appendDetail

        protected void appendDetail​(java.lang.StringBuffer buffer,
                                    java.lang.String fieldName,
                                    char value)

        Append to the toString a char value.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        value - the value to add to the toString
      • append

        public void append​(java.lang.StringBuffer buffer,
                           java.lang.String fieldName,
                           double value)

        Append to the toString a double value.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name
        value - the value to add to the toString
      • appendDetail

        protected void appendDetail​(java.lang.StringBuffer buffer,
                                    java.lang.String fieldName,
                                    double value)

        Append to the toString a double value.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        value - the value to add to the toString
      • append

        public void append​(java.lang.StringBuffer buffer,
                           java.lang.String fieldName,
                           float value)

        Append to the toString a float value.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name
        value - the value to add to the toString
      • appendDetail

        protected void appendDetail​(java.lang.StringBuffer buffer,
                                    java.lang.String fieldName,
                                    float value)

        Append to the toString a float value.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        value - the value to add to the toString
      • append

        public void append​(java.lang.StringBuffer buffer,
                           java.lang.String fieldName,
                           boolean value)

        Append to the toString a boolean value.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name
        value - the value to add to the toString
      • appendDetail

        protected void appendDetail​(java.lang.StringBuffer buffer,
                                    java.lang.String fieldName,
                                    boolean value)

        Append to the toString a boolean value.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        value - the value to add to the toString
      • append

        public void append​(java.lang.StringBuffer buffer,
                           java.lang.String fieldName,
                           java.lang.Object[] array,
                           java.lang.Boolean fullDetail)

        Append to the toString an Object array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name
        array - the array to add to the toString
        fullDetail - true for detail, false for summary info, null for style decides
      • appendDetail

        protected void appendDetail​(java.lang.StringBuffer buffer,
                                    java.lang.String fieldName,
                                    java.lang.Object[] array)

        Append to the toString the detail of an Object array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        array - the array to add to the toString, not null
      • appendDetail

        protected void appendDetail​(java.lang.StringBuffer buffer,
                                    java.lang.String fieldName,
                                    int i,
                                    java.lang.Object item)

        Append to the toString the detail of an Object array item.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        i - the array item index to add
        item - the array item to add
        Since:
        3.11
      • reflectionAppendArrayDetail

        protected void reflectionAppendArrayDetail​(java.lang.StringBuffer buffer,
                                                   java.lang.String fieldName,
                                                   java.lang.Object array)

        Append to the toString the detail of an array type.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        array - the array to add to the toString, not null
        Since:
        2.0
      • appendSummary

        protected void appendSummary​(java.lang.StringBuffer buffer,
                                     java.lang.String fieldName,
                                     java.lang.Object[] array)

        Append to the toString a summary of an Object array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        array - the array to add to the toString, not null
      • append

        public void append​(java.lang.StringBuffer buffer,
                           java.lang.String fieldName,
                           long[] array,
                           java.lang.Boolean fullDetail)

        Append to the toString a long array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name
        array - the array to add to the toString
        fullDetail - true for detail, false for summary info, null for style decides
      • appendDetail

        protected void appendDetail​(java.lang.StringBuffer buffer,
                                    java.lang.String fieldName,
                                    long[] array)

        Append to the toString the detail of a long array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        array - the array to add to the toString, not null
      • appendSummary

        protected void appendSummary​(java.lang.StringBuffer buffer,
                                     java.lang.String fieldName,
                                     long[] array)

        Append to the toString a summary of a long array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        array - the array to add to the toString, not null
      • append

        public void append​(java.lang.StringBuffer buffer,
                           java.lang.String fieldName,
                           int[] array,
                           java.lang.Boolean fullDetail)

        Append to the toString an int array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name
        array - the array to add to the toString
        fullDetail - true for detail, false for summary info, null for style decides
      • appendDetail

        protected void appendDetail​(java.lang.StringBuffer buffer,
                                    java.lang.String fieldName,
                                    int[] array)

        Append to the toString the detail of an int array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        array - the array to add to the toString, not null
      • appendSummary

        protected void appendSummary​(java.lang.StringBuffer buffer,
                                     java.lang.String fieldName,
                                     int[] array)

        Append to the toString a summary of an int array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        array - the array to add to the toString, not null
      • append

        public void append​(java.lang.StringBuffer buffer,
                           java.lang.String fieldName,
                           short[] array,
                           java.lang.Boolean fullDetail)

        Append to the toString a short array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name
        array - the array to add to the toString
        fullDetail - true for detail, false for summary info, null for style decides
      • appendDetail

        protected void appendDetail​(java.lang.StringBuffer buffer,
                                    java.lang.String fieldName,
                                    short[] array)

        Append to the toString the detail of a short array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        array - the array to add to the toString, not null
      • appendSummary

        protected void appendSummary​(java.lang.StringBuffer buffer,
                                     java.lang.String fieldName,
                                     short[] array)

        Append to the toString a summary of a short array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        array - the array to add to the toString, not null
      • append

        public void append​(java.lang.StringBuffer buffer,
                           java.lang.String fieldName,
                           byte[] array,
                           java.lang.Boolean fullDetail)

        Append to the toString a byte array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name
        array - the array to add to the toString
        fullDetail - true for detail, false for summary info, null for style decides
      • appendDetail

        protected void appendDetail​(java.lang.StringBuffer buffer,
                                    java.lang.String fieldName,
                                    byte[] array)

        Append to the toString the detail of a byte array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        array - the array to add to the toString, not null
      • appendSummary

        protected void appendSummary​(java.lang.StringBuffer buffer,
                                     java.lang.String fieldName,
                                     byte[] array)

        Append to the toString a summary of a byte array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        array - the array to add to the toString, not null
      • append

        public void append​(java.lang.StringBuffer buffer,
                           java.lang.String fieldName,
                           char[] array,
                           java.lang.Boolean fullDetail)

        Append to the toString a char array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name
        array - the array to add to the toString
        fullDetail - true for detail, false for summary info, null for style decides
      • appendDetail

        protected void appendDetail​(java.lang.StringBuffer buffer,
                                    java.lang.String fieldName,
                                    char[] array)

        Append to the toString the detail of a char array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        array - the array to add to the toString, not null
      • appendSummary

        protected void appendSummary​(java.lang.StringBuffer buffer,
                                     java.lang.String fieldName,
                                     char[] array)

        Append to the toString a summary of a char array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        array - the array to add to the toString, not null
      • append

        public void append​(java.lang.StringBuffer buffer,
                           java.lang.String fieldName,
                           double[] array,
                           java.lang.Boolean fullDetail)

        Append to the toString a double array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name
        array - the array to add to the toString
        fullDetail - true for detail, false for summary info, null for style decides
      • appendDetail

        protected void appendDetail​(java.lang.StringBuffer buffer,
                                    java.lang.String fieldName,
                                    double[] array)

        Append to the toString the detail of a double array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        array - the array to add to the toString, not null
      • appendSummary

        protected void appendSummary​(java.lang.StringBuffer buffer,
                                     java.lang.String fieldName,
                                     double[] array)

        Append to the toString a summary of a double array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        array - the array to add to the toString, not null
      • append

        public void append​(java.lang.StringBuffer buffer,
                           java.lang.String fieldName,
                           float[] array,
                           java.lang.Boolean fullDetail)

        Append to the toString a float array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name
        array - the array to add to the toString
        fullDetail - true for detail, false for summary info, null for style decides
      • appendDetail

        protected void appendDetail​(java.lang.StringBuffer buffer,
                                    java.lang.String fieldName,
                                    float[] array)

        Append to the toString the detail of a float array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        array - the array to add to the toString, not null
      • appendSummary

        protected void appendSummary​(java.lang.StringBuffer buffer,
                                     java.lang.String fieldName,
                                     float[] array)

        Append to the toString a summary of a float array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        array - the array to add to the toString, not null
      • append

        public void append​(java.lang.StringBuffer buffer,
                           java.lang.String fieldName,
                           boolean[] array,
                           java.lang.Boolean fullDetail)

        Append to the toString a boolean array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name
        array - the array to add to the toString
        fullDetail - true for detail, false for summary info, null for style decides
      • appendDetail

        protected void appendDetail​(java.lang.StringBuffer buffer,
                                    java.lang.String fieldName,
                                    boolean[] array)

        Append to the toString the detail of a boolean array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        array - the array to add to the toString, not null
      • appendSummary

        protected void appendSummary​(java.lang.StringBuffer buffer,
                                     java.lang.String fieldName,
                                     boolean[] array)

        Append to the toString a summary of a boolean array.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        array - the array to add to the toString, not null
      • appendClassName

        protected void appendClassName​(java.lang.StringBuffer buffer,
                                       java.lang.Object object)

        Append to the toString the class name.

        Parameters:
        buffer - the StringBuffer to populate
        object - the Object whose name to output
      • appendIdentityHashCode

        protected void appendIdentityHashCode​(java.lang.StringBuffer buffer,
                                              java.lang.Object object)

        Append the System.identityHashCode(java.lang.Object).

        Parameters:
        buffer - the StringBuffer to populate
        object - the Object whose id to output
      • appendContentStart

        protected void appendContentStart​(java.lang.StringBuffer buffer)

        Append to the toString the content start.

        Parameters:
        buffer - the StringBuffer to populate
      • appendContentEnd

        protected void appendContentEnd​(java.lang.StringBuffer buffer)

        Append to the toString the content end.

        Parameters:
        buffer - the StringBuffer to populate
      • appendNullText

        protected void appendNullText​(java.lang.StringBuffer buffer,
                                      java.lang.String fieldName)

        Append to the toString an indicator for null.

        The default indicator is '&lt;null&gt;'.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
      • appendFieldSeparator

        protected void appendFieldSeparator​(java.lang.StringBuffer buffer)

        Append to the toString the field separator.

        Parameters:
        buffer - the StringBuffer to populate
      • appendFieldStart

        protected void appendFieldStart​(java.lang.StringBuffer buffer,
                                        java.lang.String fieldName)

        Append to the toString the field start.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name
      • appendFieldEnd

        protected void appendFieldEnd​(java.lang.StringBuffer buffer,
                                      java.lang.String fieldName)

        Append to the toString the field end.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
      • appendSummarySize

        protected void appendSummarySize​(java.lang.StringBuffer buffer,
                                         java.lang.String fieldName,
                                         int size)

        Append to the toString a size summary.

        The size summary is used to summarize the contents of Collections, Maps and arrays.

        The output consists of a prefix, the passed in size and a suffix.

        The default format is '&lt;size=n&gt;'.

        Parameters:
        buffer - the StringBuffer to populate
        fieldName - the field name, typically not used as already appended
        size - the size to append
      • isFullDetail

        protected boolean isFullDetail​(java.lang.Boolean fullDetailRequest)

        Is this field to be output in full detail.

        This method converts a detail request into a detail level. The calling code may request full detail (true), but a subclass might ignore that and always return false. The calling code may pass in null indicating that it doesn't care about the detail level. In this case the default detail level is used.

        Parameters:
        fullDetailRequest - the detail level requested
        Returns:
        whether full detail is to be shown
      • getShortClassName

        protected java.lang.String getShortClassName​(java.lang.Class<?> cls)

        Gets the short class name for a class.

        The short class name is the classname excluding the package name.

        Parameters:
        cls - the Class to get the short name of
        Returns:
        the short name
      • isUseClassName

        protected boolean isUseClassName()

        Gets whether to use the class name.

        Returns:
        the current useClassName flag
      • setUseClassName

        protected void setUseClassName​(boolean useClassName)

        Sets whether to use the class name.

        Parameters:
        useClassName - the new useClassName flag
      • isUseShortClassName

        protected boolean isUseShortClassName()

        Gets whether to output short or long class names.

        Returns:
        the current useShortClassName flag
        Since:
        2.0
      • setUseShortClassName

        protected void setUseShortClassName​(boolean useShortClassName)

        Sets whether to output short or long class names.

        Parameters:
        useShortClassName - the new useShortClassName flag
        Since:
        2.0
      • isUseIdentityHashCode

        protected boolean isUseIdentityHashCode()

        Gets whether to use the identity hash code.

        Returns:
        the current useIdentityHashCode flag
      • setUseIdentityHashCode

        protected void setUseIdentityHashCode​(boolean useIdentityHashCode)

        Sets whether to use the identity hash code.

        Parameters:
        useIdentityHashCode - the new useIdentityHashCode flag
      • isUseFieldNames

        protected boolean isUseFieldNames()

        Gets whether to use the field names passed in.

        Returns:
        the current useFieldNames flag
      • setUseFieldNames

        protected void setUseFieldNames​(boolean useFieldNames)

        Sets whether to use the field names passed in.

        Parameters:
        useFieldNames - the new useFieldNames flag
      • isDefaultFullDetail

        protected boolean isDefaultFullDetail()

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

        Returns:
        the current defaultFullDetail flag
      • setDefaultFullDetail

        protected void setDefaultFullDetail​(boolean defaultFullDetail)

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

        Parameters:
        defaultFullDetail - the new defaultFullDetail flag
      • isArrayContentDetail

        protected boolean isArrayContentDetail()

        Gets whether to output array content detail.

        Returns:
        the current array content detail setting
      • setArrayContentDetail

        protected void setArrayContentDetail​(boolean arrayContentDetail)

        Sets whether to output array content detail.

        Parameters:
        arrayContentDetail - the new arrayContentDetail flag
      • getArrayStart

        protected java.lang.String getArrayStart()

        Gets the array start text.

        Returns:
        the current array start text
      • setArrayStart

        protected void setArrayStart​(java.lang.String arrayStart)

        Sets the array start text.

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

        Parameters:
        arrayStart - the new array start text
      • getArrayEnd

        protected java.lang.String getArrayEnd()

        Gets the array end text.

        Returns:
        the current array end text
      • setArrayEnd

        protected void setArrayEnd​(java.lang.String arrayEnd)

        Sets the array end text.

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

        Parameters:
        arrayEnd - the new array end text
      • getArraySeparator

        protected java.lang.String getArraySeparator()

        Gets the array separator text.

        Returns:
        the current array separator text
      • setArraySeparator

        protected void setArraySeparator​(java.lang.String arraySeparator)

        Sets the array separator text.

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

        Parameters:
        arraySeparator - the new array separator text
      • getContentStart

        protected java.lang.String getContentStart()

        Gets the content start text.

        Returns:
        the current content start text
      • setContentStart

        protected void setContentStart​(java.lang.String contentStart)

        Sets the content start text.

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

        Parameters:
        contentStart - the new content start text
      • getContentEnd

        protected java.lang.String getContentEnd()

        Gets the content end text.

        Returns:
        the current content end text
      • setContentEnd

        protected void setContentEnd​(java.lang.String contentEnd)

        Sets the content end text.

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

        Parameters:
        contentEnd - the new content end text
      • getFieldNameValueSeparator

        protected java.lang.String getFieldNameValueSeparator()

        Gets the field name value separator text.

        Returns:
        the current field name value separator text
      • setFieldNameValueSeparator

        protected void setFieldNameValueSeparator​(java.lang.String fieldNameValueSeparator)

        Sets the field name value separator text.

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

        Parameters:
        fieldNameValueSeparator - the new field name value separator text
      • getFieldSeparator

        protected java.lang.String getFieldSeparator()

        Gets the field separator text.

        Returns:
        the current field separator text
      • setFieldSeparator

        protected void setFieldSeparator​(java.lang.String fieldSeparator)

        Sets the field separator text.

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

        Parameters:
        fieldSeparator - the new field separator text
      • isFieldSeparatorAtStart

        protected boolean isFieldSeparatorAtStart()

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

        Returns:
        the fieldSeparatorAtStart flag
        Since:
        2.0
      • setFieldSeparatorAtStart

        protected void setFieldSeparatorAtStart​(boolean fieldSeparatorAtStart)

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

        Parameters:
        fieldSeparatorAtStart - the fieldSeparatorAtStart flag
        Since:
        2.0
      • isFieldSeparatorAtEnd

        protected boolean isFieldSeparatorAtEnd()

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

        Returns:
        fieldSeparatorAtEnd flag
        Since:
        2.0
      • setFieldSeparatorAtEnd

        protected void setFieldSeparatorAtEnd​(boolean fieldSeparatorAtEnd)

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

        Parameters:
        fieldSeparatorAtEnd - the fieldSeparatorAtEnd flag
        Since:
        2.0
      • getNullText

        protected java.lang.String getNullText()

        Gets the text to output when null found.

        Returns:
        the current text to output when null found
      • setNullText

        protected void setNullText​(java.lang.String nullText)

        Sets the text to output when null found.

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

        Parameters:
        nullText - the new text to output when null found
      • getSizeStartText

        protected java.lang.String getSizeStartText()

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

        This is output before the size value.

        Returns:
        the current start of size text
      • setSizeStartText

        protected void setSizeStartText​(java.lang.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.

        Parameters:
        sizeStartText - the new start of size text
      • getSizeEndText

        protected java.lang.String getSizeEndText()

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

        This is output after the size value.

        Returns:
        the current end of size text
      • setSizeEndText

        protected void setSizeEndText​(java.lang.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.

        Parameters:
        sizeEndText - the new end of size text
      • getSummaryObjectStartText

        protected java.lang.String getSummaryObjectStartText()

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

        This is output before the size value.

        Returns:
        the current start of summary text
      • setSummaryObjectStartText

        protected void setSummaryObjectStartText​(java.lang.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.

        Parameters:
        summaryObjectStartText - the new start of summary text
      • getSummaryObjectEndText

        protected java.lang.String getSummaryObjectEndText()

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

        This is output after the size value.

        Returns:
        the current end of summary text
      • setSummaryObjectEndText

        protected void setSummaryObjectEndText​(java.lang.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.

        Parameters:
        summaryObjectEndText - the new end of summary text