MultilineRecursiveToStringStyle

public class org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle extends RecursiveToStringStyle[source]

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[ <br> &nbsp; name=Stephen, <br> &nbsp; age=29, <br> &nbsp; smokealse, <br> &nbsp; job=Job@43cd2[ <br> &nbsp; &nbsp; title=Manager <br> &nbsp;  ] <br> ]
Since:

3.4

Constructors

MultilineRecursiveToStringStyle()

Constructs a new instance.

public MultilineRecursiveToStringStyle()[source]

Constructs a new instance.

Methods

appendDetail(StringBuffer, String, boolean[])

Appends to the toString the detail of a boolean array.

appendDetail(StringBuffer, String, byte[])

Appends to the toString the detail of a byte array.

appendDetail(StringBuffer, String, char[])

Appends to the toString the detail of a char array.

appendDetail(StringBuffer, String, double[])

Appends to the toString the detail of a double array.

appendDetail(StringBuffer, String, float[])

Appends to the toString the detail of a float array.

appendDetail(StringBuffer, String, int[])

Appends to the toString the detail of an int array.

appendDetail(StringBuffer, String, Object)

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

appendDetail(StringBuffer, String, Object[])

Appends to the toString the detail of an Object array.

appendDetail(StringBuffer, String, long[])

Appends to the toString the detail of a long array.

appendDetail(StringBuffer, String, short[])

Appends to the toString the detail of a short array.

reflectionAppendArrayDetail(StringBuffer, String, Object)

Appends to the toString the detail of an array type.

@Override protected void appendDetail(StringBuffer buffer, String fieldName, boolean[] array)[source]

Appends 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.

@Override protected void appendDetail(StringBuffer buffer, String fieldName, byte[] array)[source]

Appends 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.

@Override protected void appendDetail(StringBuffer buffer, String fieldName, char[] array)[source]

Appends 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.

@Override protected void appendDetail(StringBuffer buffer, String fieldName, double[] array)[source]

Appends 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.

@Override protected void appendDetail(StringBuffer buffer, String fieldName, float[] array)[source]

Appends 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.

@Override protected void appendDetail(StringBuffer buffer, String fieldName, int[] array)[source]

Appends 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.

@Override public void appendDetail(StringBuffer buffer, String fieldName, Object value)[source]

Appends 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.

@Override protected void appendDetail(StringBuffer buffer, String fieldName, Object[] array)[source]

Appends 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.

@Override protected void appendDetail(StringBuffer buffer, String fieldName, long[] array)[source]

Appends 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.

@Override protected void appendDetail(StringBuffer buffer, String fieldName, short[] array)[source]

Appends 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.

@Override protected void reflectionAppendArrayDetail(StringBuffer buffer, String fieldName, Object array)[source]

Appends 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.