org.apache.commons.lang3.builder

## Class MultilineRecursiveToStringStyle

- java.lang.Object
- - org.apache.commons.lang3.builder.ToStringStyle
  - - org.apache.commons.lang3.builder.RecursiveToStringStyle
    - - org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle

- All Implemented Interfaces:
    Serializable

      public class MultilineRecursiveToStringStyle
      extends RecursiveToStringStyle

  Works with `ToStringBuilder` to create a "deep" `toString`. But instead a single line like the `RecursiveToStringStyle` this creates a multiline String similar to the `ToStringStyle.MULTI_LINE_STYLE`.

  To use this class write code as follows:

       public class Job {
         String title;
         ...
       }

       public class Person {
         String name;
         int age;
         boolean smoker;
         Job job;

         ...

         public String toString() {
           return new ReflectionToStringBuilder(this, new MultilineRecursiveToStringStyle()).toString();
         }
       }

  This will produce a toString of the format:
  `Person@7f54[
  name=Stephen,
  age=29,
  smoker=false,
  job=Job@43cd2[
  title=Manager
  ]
  ]`

  Since:
    3.4
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.apache.commons.lang3.builder.ToStringStyle

      `DEFAULT_STYLE, JSON_STYLE, MULTI_LINE_STYLE, NO_CLASS_NAME_STYLE, NO_FIELD_NAMES_STYLE, SHORT_PREFIX_STYLE, SIMPLE_STYLE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MultilineRecursiveToStringStyle()` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `appendDetail(StringBuffer buffer, String fieldName, boolean[] array)` Appends to the `toString` the detail of a `boolean` array.
    `protected void` | `appendDetail(StringBuffer buffer, String fieldName, byte[] array)` Appends to the `toString` the detail of a `byte` array.
    `protected void` | `appendDetail(StringBuffer buffer, String fieldName, char[] array)` Appends to the `toString` the detail of a `char` array.
    `protected void` | `appendDetail(StringBuffer buffer, String fieldName, double[] array)` Appends to the `toString` the detail of a `double` array.
    `protected void` | `appendDetail(StringBuffer buffer, String fieldName, float[] array)` Appends to the `toString` the detail of a `float` array.
    `protected void` | `appendDetail(StringBuffer buffer, String fieldName, int[] array)` Appends to the `toString` the detail of an `int` array.
    `protected void` | `appendDetail(StringBuffer buffer, String fieldName, long[] array)` Appends to the `toString` the detail of a `long` array.
    `void` | `appendDetail(StringBuffer buffer, String fieldName, Object value)` Appends to the `toString` an `Object` value, printing the full detail of the `Object`.
    `protected void` | `appendDetail(StringBuffer buffer, String fieldName, Object[] array)` Appends to the `toString` the detail of an `Object` array.
    `protected void` | `appendDetail(StringBuffer buffer, String fieldName, short[] array)` Appends to the `toString` the detail of a `short` array.
    `protected void` | `reflectionAppendArrayDetail(StringBuffer buffer, String fieldName, Object array)` Appends to the `toString` the detail of an array type.

    - ### Methods inherited from class org.apache.commons.lang3.builder.RecursiveToStringStyle

      `accept, appendDetail`

    - ### Methods inherited from class org.apache.commons.lang3.builder.ToStringStyle

      `append, append, append, append, append, append, append, append, append, append, append, append, append, append, append, append, append, append, appendClassName, appendContentEnd, appendContentStart, appendCyclicObject, appendDetail, appendDetail, appendDetail, appendDetail, appendDetail, appendDetail, appendDetail, appendDetail, appendDetail, appendDetail, appendEnd, appendFieldEnd, appendFieldSeparator, appendFieldStart, appendIdentityHashCode, appendInternal, appendNullText, appendStart, appendSummary, appendSummary, appendSummary, appendSummary, appendSummary, appendSummary, appendSummary, appendSummary, appendSummary, appendSummary, appendSummarySize, appendSuper, appendToString, getArrayEnd, getArraySeparator, getArrayStart, getContentEnd, getContentStart, getFieldNameValueSeparator, getFieldSeparator, getNullText, getRegistry, getShortClassName, getSizeEndText, getSizeStartText, getSummaryObjectEndText, getSummaryObjectStartText, isArrayContentDetail, isDefaultFullDetail, isFieldSeparatorAtEnd, isFieldSeparatorAtStart, isFullDetail, isUseClassName, isUseFieldNames, isUseIdentityHashCode, isUseShortClassName, removeLastFieldSeparator, setArrayContentDetail, setArrayEnd, setArraySeparator, setArrayStart, setContentEnd, setContentStart, setDefaultFullDetail, setFieldNameValueSeparator, setFieldSeparator, setFieldSeparatorAtEnd, setFieldSeparatorAtStart, setNullText, setSizeEndText, setSizeStartText, setSummaryObjectEndText, setSummaryObjectStartText, setUseClassName, setUseFieldNames, setUseIdentityHashCode, setUseShortClassName`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MultilineRecursiveToStringStyle

          public MultilineRecursiveToStringStyle()

      Constructor.

  - ### Method Detail

    - #### appendDetail

          public void appendDetail(StringBuffer buffer,
                                   String fieldName,
                                   Object value)

      Description copied from class: `ToStringStyle`
      Appends to the `toString` an `Object` value, printing the full detail of the `Object`.
      Overrides:
        `appendDetail` in class `RecursiveToStringStyle`
      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(StringBuffer buffer,
                                      String fieldName,
                                      Object[] array)

      Description copied from class: `ToStringStyle`
      Appends to the `toString` the detail of an `Object` array.
      Overrides:
        `appendDetail` in class `ToStringStyle`
      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`

    - #### reflectionAppendArrayDetail

          protected void reflectionAppendArrayDetail(StringBuffer buffer,
                                                     String fieldName,
                                                     Object array)

      Description copied from class: `ToStringStyle`
      Appends to the `toString` the detail of an array type.
      Overrides:
        `reflectionAppendArrayDetail` in class `ToStringStyle`
      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(StringBuffer buffer,
                                      String fieldName,
                                      long[] array)

      Description copied from class: `ToStringStyle`
      Appends to the `toString` the detail of a `long` array.
      Overrides:
        `appendDetail` in class `ToStringStyle`
      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(StringBuffer buffer,
                                      String fieldName,
                                      int[] array)

      Description copied from class: `ToStringStyle`
      Appends to the `toString` the detail of an `int` array.
      Overrides:
        `appendDetail` in class `ToStringStyle`
      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(StringBuffer buffer,
                                      String fieldName,
                                      short[] array)

      Description copied from class: `ToStringStyle`
      Appends to the `toString` the detail of a `short` array.
      Overrides:
        `appendDetail` in class `ToStringStyle`
      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(StringBuffer buffer,
                                      String fieldName,
                                      byte[] array)

      Description copied from class: `ToStringStyle`
      Appends to the `toString` the detail of a `byte` array.
      Overrides:
        `appendDetail` in class `ToStringStyle`
      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(StringBuffer buffer,
                                      String fieldName,
                                      char[] array)

      Description copied from class: `ToStringStyle`
      Appends to the `toString` the detail of a `char` array.
      Overrides:
        `appendDetail` in class `ToStringStyle`
      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(StringBuffer buffer,
                                      String fieldName,
                                      double[] array)

      Description copied from class: `ToStringStyle`
      Appends to the `toString` the detail of a `double` array.
      Overrides:
        `appendDetail` in class `ToStringStyle`
      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(StringBuffer buffer,
                                      String fieldName,
                                      float[] array)

      Description copied from class: `ToStringStyle`
      Appends to the `toString` the detail of a `float` array.
      Overrides:
        `appendDetail` in class `ToStringStyle`
      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(StringBuffer buffer,
                                      String fieldName,
                                      boolean[] array)

      Description copied from class: `ToStringStyle`
      Appends to the `toString` the detail of a `boolean` array.
      Overrides:
        `appendDetail` in class `ToStringStyle`
      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`

Copyright © 2001–2023 The Apache Software Foundation. All rights reserved.