Package org.apache.commons.lang3.builder
Class RecursiveToStringStyle
java.lang.Object
org.apache.commons.lang3.builder.ToStringStyle
org.apache.commons.lang3.builder.RecursiveToStringStyle
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
MultilineRecursiveToStringStyle
Works with
ToStringBuilder to create a "deep" toString.
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 RecursiveToStringStyle()).toString();
}
}
This will produce a toString of the format:
Person@7f54[name=Stephen,age=29,smoker=false,job=Job@43cd2[title=Manager]]
- Since:
- 3.2
- See Also:
-
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidappendDetail(StringBuffer buffer, String fieldName, 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
-
Constructor Details
-
RecursiveToStringStyle
public RecursiveToStringStyle()Constructor.
-
-
Method Details
-
appendDetail
-