public class MultilineToStringStyle extends RecursiveToStringStyle
ToStringBuilder创建一个“deep”toString。
而是像RecursiveToStringStyle这样的单行,
创建类似ToStringStyle.MULTI_LINE_STYLE的多行字符串。
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();
}
}
DEFAULT_STYLE, JSON_STYLE, MULTI_LINE_STYLE, NO_CLASS_NAME_STYLE, NO_FIELD_NAMES_STYLE, SHORT_PREFIX_STYLE, SIMPLE_STYLE| Constructor and Description |
|---|
MultilineToStringStyle() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
appendDetail(StringBuffer buffer,
String fieldName,
boolean[] array)
Append to the
toString the detail of a
boolean array. |
protected void |
appendDetail(StringBuffer buffer,
String fieldName,
byte[] array)
Append to the
toString the detail of a
byte array. |
protected void |
appendDetail(StringBuffer buffer,
String fieldName,
char[] array)
Append to the
toString the detail of a
char array. |
protected void |
appendDetail(StringBuffer buffer,
String fieldName,
double[] array)
Append to the
toString the detail of a
double array. |
protected void |
appendDetail(StringBuffer buffer,
String fieldName,
float[] array)
Append to the
toString the detail of a
float array. |
protected void |
appendDetail(StringBuffer buffer,
String fieldName,
int[] array)
Append to the
toString the detail of an
int array. |
protected void |
appendDetail(StringBuffer buffer,
String fieldName,
long[] array)
Append to the
toString the detail of a
long array. |
void |
appendDetail(StringBuffer buffer,
String fieldName,
Object value)
Append to the
toString an Object
value, printing the full detail of the Object. |
protected void |
appendDetail(StringBuffer buffer,
String fieldName,
Object[] array)
Append to the
toString the detail of an
Object array. |
protected void |
appendDetail(StringBuffer buffer,
String fieldName,
short[] array)
Append to the
toString the detail of a
short array. |
protected void |
reflectionAppendArrayDetail(StringBuffer buffer,
String fieldName,
Object array)
Append to the
toString the detail of an array type. |
accept, appendDetailappend, 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, 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, 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, setUseShortClassNamepublic void appendDetail(StringBuffer buffer, String fieldName, Object value)
ToStringStyleAppend to the toString an Object
value, printing the full detail of the Object.
appendDetail in class RecursiveToStringStylebuffer - the StringBuffer to populatefieldName - the field name, typically not used as already appendedvalue - the value to add to the toString,
not nullprotected void appendDetail(StringBuffer buffer, String fieldName, Object[] array)
ToStringStyleAppend to the toString the detail of an
Object array.
appendDetail in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field name, typically not used as already appendedarray - the array to add to the toString,
not nullprotected void reflectionAppendArrayDetail(StringBuffer buffer, String fieldName, Object array)
ToStringStyleAppend to the toString the detail of an array type.
reflectionAppendArrayDetail in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field name, typically not used as already appendedarray - the array to add to the toString,
not nullprotected void appendDetail(StringBuffer buffer, String fieldName, long[] array)
ToStringStyleAppend to the toString the detail of a
long array.
appendDetail in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field name, typically not used as already appendedarray - the array to add to the toString,
not nullprotected void appendDetail(StringBuffer buffer, String fieldName, int[] array)
ToStringStyleAppend to the toString the detail of an
int array.
appendDetail in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field name, typically not used as already appendedarray - the array to add to the toString,
not nullprotected void appendDetail(StringBuffer buffer, String fieldName, short[] array)
ToStringStyleAppend to the toString the detail of a
short array.
appendDetail in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field name, typically not used as already appendedarray - the array to add to the toString,
not nullprotected void appendDetail(StringBuffer buffer, String fieldName, byte[] array)
ToStringStyleAppend to the toString the detail of a
byte array.
appendDetail in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field name, typically not used as already appendedarray - the array to add to the toString,
not nullprotected void appendDetail(StringBuffer buffer, String fieldName, char[] array)
ToStringStyleAppend to the toString the detail of a
char array.
appendDetail in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field name, typically not used as already appendedarray - the array to add to the toString,
not nullprotected void appendDetail(StringBuffer buffer, String fieldName, double[] array)
ToStringStyleAppend to the toString the detail of a
double array.
appendDetail in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field name, typically not used as already appendedarray - the array to add to the toString,
not nullprotected void appendDetail(StringBuffer buffer, String fieldName, float[] array)
ToStringStyleAppend to the toString the detail of a
float array.
appendDetail in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field name, typically not used as already appendedarray - the array to add to the toString,
not nullprotected void appendDetail(StringBuffer buffer, String fieldName, boolean[] array)
ToStringStyleAppend to the toString the detail of a
boolean array.
appendDetail in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field name, typically not used as already appendedarray - the array to add to the toString,
not nullCopyright © 2020. All rights reserved.