Package 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:
java.io.Serializable
public class MultilineRecursiveToStringStyle extends RecursiveToStringStyle
Works withToStringBuilderto create a "deep"toString. But instead a single line like theRecursiveToStringStylethis creates a multiline String similar to theToStringStyle.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> name=Stephen, <br> age=29, <br> smokealse, <br> job=Job@43cd2[ <br> title=Manager <br> ] <br> ]- 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 Description MultilineRecursiveToStringStyle()Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendDetail(java.lang.StringBuffer buffer, java.lang.String fieldName, java.lang.Object value)-
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, appendEnd, appendStart, appendSuper, appendToString, getRegistry
-
-
-
-
Method Detail
-
appendDetail
public void appendDetail(java.lang.StringBuffer buffer, java.lang.String fieldName, java.lang.Object value)- Overrides:
appendDetailin classRecursiveToStringStyle
-
-