private static final class ToStringStyle.JsonToStringStyle extends ToStringStyle
ToStringStyle that outputs with JSON format.
This is an inner class rather than using
StandardToStringStyle to ensure its immutability.
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
FIELD_NAME_QUOTE |
private static long |
serialVersionUID |
DEFAULT_STYLE, JSON_STYLE, MULTI_LINE_STYLE, NO_CLASS_NAME_STYLE, NO_FIELD_NAMES_STYLE, SHORT_PREFIX_STYLE, SIMPLE_STYLE| Constructor and Description |
|---|
JsonToStringStyle()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
append(java.lang.StringBuffer buffer,
java.lang.String fieldName,
boolean[] array,
java.lang.Boolean fullDetail)
Append to the
toString a boolean
array. |
void |
append(java.lang.StringBuffer buffer,
java.lang.String fieldName,
byte[] array,
java.lang.Boolean fullDetail)
Append to the
toString a byte
array. |
void |
append(java.lang.StringBuffer buffer,
java.lang.String fieldName,
char[] array,
java.lang.Boolean fullDetail)
Append to the
toString a char
array. |
void |
append(java.lang.StringBuffer buffer,
java.lang.String fieldName,
double[] array,
java.lang.Boolean fullDetail)
Append to the
toString a double
array. |
void |
append(java.lang.StringBuffer buffer,
java.lang.String fieldName,
float[] array,
java.lang.Boolean fullDetail)
Append to the
toString a float
array. |
void |
append(java.lang.StringBuffer buffer,
java.lang.String fieldName,
int[] array,
java.lang.Boolean fullDetail)
Append to the
toString an int
array. |
void |
append(java.lang.StringBuffer buffer,
java.lang.String fieldName,
long[] array,
java.lang.Boolean fullDetail)
Append to the
toString a long
array. |
void |
append(java.lang.StringBuffer buffer,
java.lang.String fieldName,
java.lang.Object[] array,
java.lang.Boolean fullDetail)
Append to the
toString an Object
array. |
void |
append(java.lang.StringBuffer buffer,
java.lang.String fieldName,
java.lang.Object value,
java.lang.Boolean fullDetail)
Append to the
toString an Object
value, printing the full toString of the
Object passed in. |
void |
append(java.lang.StringBuffer buffer,
java.lang.String fieldName,
short[] array,
java.lang.Boolean fullDetail)
Append to the
toString a short
array. |
protected void |
appendDetail(java.lang.StringBuffer buffer,
java.lang.String fieldName,
char value)
Append to the
toString a char
value. |
protected void |
appendDetail(java.lang.StringBuffer buffer,
java.lang.String fieldName,
java.lang.Object value)
Append to the
toString an Object
value, printing the full detail of the Object. |
protected void |
appendFieldStart(java.lang.StringBuffer buffer,
java.lang.String fieldName)
Append to the
toString the field start. |
private void |
appendValueAsString(java.lang.StringBuffer buffer,
java.lang.String value)
Appends the given String in parenthesis to the given StringBuffer.
|
private boolean |
isJsonArray(java.lang.String valueAsString) |
private boolean |
isJsonObject(java.lang.String valueAsString) |
private java.lang.Object |
readResolve()
Ensure
Singleton after serialization. |
append, append, append, append, append, append, append, append, appendClassName, appendContentEnd, appendContentStart, appendCyclicObject, appendDetail, appendDetail, appendDetail, appendDetail, appendDetail, appendDetail, appendDetail, appendDetail, appendDetail, appendDetail, appendDetail, appendDetail, appendDetail, appendDetail, appendDetail, appendDetail, appendDetail, appendDetail, appendEnd, appendFieldEnd, appendFieldSeparator, 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, getRegistry, getShortClassName, getSizeEndText, getSizeStartText, getSummaryObjectEndText, getSummaryObjectStartText, isArrayContentDetail, isDefaultFullDetail, isFieldSeparatorAtEnd, isFieldSeparatorAtStart, isFullDetail, isRegistered, isUseClassName, isUseFieldNames, isUseIdentityHashCode, isUseShortClassName, reflectionAppendArrayDetail, register, removeLastFieldSeparator, setArrayContentDetail, setArrayEnd, setArraySeparator, setArrayStart, setContentEnd, setContentStart, setDefaultFullDetail, setFieldNameValueSeparator, setFieldSeparator, setFieldSeparatorAtEnd, setFieldSeparatorAtStart, setNullText, setSizeEndText, setSizeStartText, setSummaryObjectEndText, setSummaryObjectStartText, setUseClassName, setUseFieldNames, setUseIdentityHashCode, setUseShortClassName, unregisterprivate static final long serialVersionUID
private static final java.lang.String FIELD_NAME_QUOTE
JsonToStringStyle()
Constructor.
Use the static constant rather than instantiating.
public void append(java.lang.StringBuffer buffer,
java.lang.String fieldName,
java.lang.Object[] array,
java.lang.Boolean fullDetail)
ToStringStyleAppend to the toString an Object
array.
append in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field namearray - the array to add to the toStringfullDetail - true for detail, false
for summary info, null for style decidespublic void append(java.lang.StringBuffer buffer,
java.lang.String fieldName,
long[] array,
java.lang.Boolean fullDetail)
ToStringStyleAppend to the toString a long
array.
append in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field namearray - the array to add to the toStringfullDetail - true for detail, false
for summary info, null for style decidespublic void append(java.lang.StringBuffer buffer,
java.lang.String fieldName,
int[] array,
java.lang.Boolean fullDetail)
ToStringStyleAppend to the toString an int
array.
append in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field namearray - the array to add to the toStringfullDetail - true for detail, false
for summary info, null for style decidespublic void append(java.lang.StringBuffer buffer,
java.lang.String fieldName,
short[] array,
java.lang.Boolean fullDetail)
ToStringStyleAppend to the toString a short
array.
append in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field namearray - the array to add to the toStringfullDetail - true for detail, false
for summary info, null for style decidespublic void append(java.lang.StringBuffer buffer,
java.lang.String fieldName,
byte[] array,
java.lang.Boolean fullDetail)
ToStringStyleAppend to the toString a byte
array.
append in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field namearray - the array to add to the toStringfullDetail - true for detail, false
for summary info, null for style decidespublic void append(java.lang.StringBuffer buffer,
java.lang.String fieldName,
char[] array,
java.lang.Boolean fullDetail)
ToStringStyleAppend to the toString a char
array.
append in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field namearray - the array to add to the toStringfullDetail - true for detail, false
for summary info, null for style decidespublic void append(java.lang.StringBuffer buffer,
java.lang.String fieldName,
double[] array,
java.lang.Boolean fullDetail)
ToStringStyleAppend to the toString a double
array.
append in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field namearray - the array to add to the toStringfullDetail - true for detail, false
for summary info, null for style decidespublic void append(java.lang.StringBuffer buffer,
java.lang.String fieldName,
float[] array,
java.lang.Boolean fullDetail)
ToStringStyleAppend to the toString a float
array.
append in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field namearray - the array to add to the toStringfullDetail - true for detail, false
for summary info, null for style decidespublic void append(java.lang.StringBuffer buffer,
java.lang.String fieldName,
boolean[] array,
java.lang.Boolean fullDetail)
ToStringStyleAppend to the toString a boolean
array.
append in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field namearray - the array to add to the toStringfullDetail - true for detail, false
for summary info, null for style decidespublic void append(java.lang.StringBuffer buffer,
java.lang.String fieldName,
java.lang.Object value,
java.lang.Boolean fullDetail)
ToStringStyleAppend to the toString an Object
value, printing the full toString of the
Object passed in.
append in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field namevalue - the value to add to the toStringfullDetail - true for detail, false
for summary info, null for style decidesprotected void appendDetail(java.lang.StringBuffer buffer,
java.lang.String fieldName,
char value)
ToStringStyleAppend to the toString a char
value.
appendDetail in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field name, typically not used as already appendedvalue - the value to add to the toStringprotected void appendDetail(java.lang.StringBuffer buffer,
java.lang.String fieldName,
java.lang.Object value)
ToStringStyleAppend to the toString an Object
value, printing the full detail of the Object.
appendDetail in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field name, typically not used as already appendedvalue - the value to add to the toString,
not nullprivate boolean isJsonArray(java.lang.String valueAsString)
private boolean isJsonObject(java.lang.String valueAsString)
private void appendValueAsString(java.lang.StringBuffer buffer,
java.lang.String value)
buffer - the StringBuffer to append the value to.value - the value to append.protected void appendFieldStart(java.lang.StringBuffer buffer,
java.lang.String fieldName)
ToStringStyleAppend to the toString the field start.
appendFieldStart in class ToStringStylebuffer - the StringBuffer to populatefieldName - the field nameprivate java.lang.Object readResolve()
Ensure Singleton after serialization.