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]]
| Modifier and Type | Field and Description |
|---|---|
| private static final long | serialVersionUID
Hides org. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected boolean | |
| protected void | appendDetail(final StringBuffer buffer, final String fieldName, final Collection<?> coll)
Overrides org. Appends to the |
| public void | appendDetail(final StringBuffer buffer, final String fieldName, final Object value)
Overrides org. Appends to the |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides org. Required for serialization support.
| |
| RecursiveToStringStyle | back to summary |
|---|---|
| public RecursiveToStringStyle() Constructs a new instance. | |
| accept | back to summary |
|---|---|
| protected boolean accept(final Class<?> clazz) Returns whether or not to recursively format the given | |
| appendDetail | back to summary |
|---|---|
| protected void appendDetail(final StringBuffer buffer, final String fieldName, final Collection<?> coll) Overrides org. Doc from org. Appends to the
| |
| appendDetail | back to summary |
|---|---|
| public void appendDetail(final StringBuffer buffer, final String fieldName, final Object value) Overrides org. Doc from org. Appends to the
| |