Class ToStringStyle.JsonToStringStyle
- All Implemented Interfaces:
Serializable
- Enclosing class:
- ToStringStyle
ToStringStyle that outputs with JSON format.
This is an inner class rather than using
StandardToStringStyle to ensure its immutability.
- Since:
- 3.4
- See Also:
-
Field Summary
FieldsFields 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 TypeMethodDescriptionvoidappend(StringBuffer buffer, String fieldName, boolean[] array, Boolean fullDetail) Append to thetoStringabooleanarray.voidappend(StringBuffer buffer, String fieldName, byte[] array, Boolean fullDetail) Append to thetoStringabytearray.voidappend(StringBuffer buffer, String fieldName, char[] array, Boolean fullDetail) Append to thetoStringachararray.voidappend(StringBuffer buffer, String fieldName, double[] array, Boolean fullDetail) Append to thetoStringadoublearray.voidappend(StringBuffer buffer, String fieldName, float[] array, Boolean fullDetail) Append to thetoStringafloatarray.voidappend(StringBuffer buffer, String fieldName, int[] array, Boolean fullDetail) Append to thetoStringanintarray.voidappend(StringBuffer buffer, String fieldName, long[] array, Boolean fullDetail) Append to thetoStringalongarray.voidappend(StringBuffer buffer, String fieldName, short[] array, Boolean fullDetail) Append to thetoStringashortarray.voidappend(StringBuffer buffer, String fieldName, Object[] array, Boolean fullDetail) Append to thetoStringanObjectarray.voidappend(StringBuffer buffer, String fieldName, Object value, Boolean fullDetail) Append to thetoStringanObjectvalue, printing the fulltoStringof theObjectpassed in.protected voidappendDetail(StringBuffer buffer, String fieldName, char value) Append to thetoStringacharvalue.protected voidappendDetail(StringBuffer buffer, String fieldName, Object value) Append to thetoStringanObjectvalue, printing the full detail of theObject.protected voidappendDetail(StringBuffer buffer, String fieldName, Collection<?> coll) Append to thetoStringaCollection.protected voidappendDetail(StringBuffer buffer, String fieldName, Map<?, ?> map) Append to thetoStringaMap.protected voidappendFieldStart(StringBuffer buffer, String fieldName) Append to thetoStringthe field start.private voidappendValueAsString(StringBuffer buffer, String value) Appends the given String enclosed in double-quotes to the given StringBuffer.private booleanisJsonArray(String valueAsString) private booleanisJsonObject(String valueAsString) private ObjectEnsureSingletonafter serialization.Methods inherited from class org.apache.commons.lang3.builder.ToStringStyle
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, 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, unregister
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
FIELD_NAME_QUOTE
- See Also:
-
-
Constructor Details
-
JsonToStringStyle
JsonToStringStyle()Constructor.
Use the static constant rather than instantiating.
-
-
Method Details
-
append
Description copied from class:ToStringStyleAppend to the
toStringanObjectarray.- Overrides:
appendin classToStringStyle- Parameters:
buffer- theStringBufferto populatefieldName- the field namearray- the array to add to the toStringfullDetail-truefor detail,falsefor summary info,nullfor style decides
-
append
Description copied from class:ToStringStyleAppend to the
toStringalongarray.- Overrides:
appendin classToStringStyle- Parameters:
buffer- theStringBufferto populatefieldName- the field namearray- the array to add to thetoStringfullDetail-truefor detail,falsefor summary info,nullfor style decides
-
append
Description copied from class:ToStringStyleAppend to the
toStringanintarray.- Overrides:
appendin classToStringStyle- Parameters:
buffer- theStringBufferto populatefieldName- the field namearray- the array to add to thetoStringfullDetail-truefor detail,falsefor summary info,nullfor style decides
-
append
Description copied from class:ToStringStyleAppend to the
toStringashortarray.- Overrides:
appendin classToStringStyle- Parameters:
buffer- theStringBufferto populatefieldName- the field namearray- the array to add to thetoStringfullDetail-truefor detail,falsefor summary info,nullfor style decides
-
append
Description copied from class:ToStringStyleAppend to the
toStringabytearray.- Overrides:
appendin classToStringStyle- Parameters:
buffer- theStringBufferto populatefieldName- the field namearray- the array to add to thetoStringfullDetail-truefor detail,falsefor summary info,nullfor style decides
-
append
Description copied from class:ToStringStyleAppend to the
toStringachararray.- Overrides:
appendin classToStringStyle- Parameters:
buffer- theStringBufferto populatefieldName- the field namearray- the array to add to thetoStringfullDetail-truefor detail,falsefor summary info,nullfor style decides
-
append
Description copied from class:ToStringStyleAppend to the
toStringadoublearray.- Overrides:
appendin classToStringStyle- Parameters:
buffer- theStringBufferto populatefieldName- the field namearray- the array to add to the toStringfullDetail-truefor detail,falsefor summary info,nullfor style decides
-
append
Description copied from class:ToStringStyleAppend to the
toStringafloatarray.- Overrides:
appendin classToStringStyle- Parameters:
buffer- theStringBufferto populatefieldName- the field namearray- the array to add to the toStringfullDetail-truefor detail,falsefor summary info,nullfor style decides
-
append
Description copied from class:ToStringStyleAppend to the
toStringabooleanarray.- Overrides:
appendin classToStringStyle- Parameters:
buffer- theStringBufferto populatefieldName- the field namearray- the array to add to the toStringfullDetail-truefor detail,falsefor summary info,nullfor style decides
-
append
Description copied from class:ToStringStyleAppend to the
toStringanObjectvalue, printing the fulltoStringof theObjectpassed in.- Overrides:
appendin classToStringStyle- Parameters:
buffer- theStringBufferto populatefieldName- the field namevalue- the value to add to thetoStringfullDetail-truefor detail,falsefor summary info,nullfor style decides
-
appendDetail
Description copied from class:ToStringStyleAppend to the
toStringacharvalue.- Overrides:
appendDetailin classToStringStyle- Parameters:
buffer- theStringBufferto populatefieldName- the field name, typically not used as already appendedvalue- the value to add to thetoString
-
appendDetail
Description copied from class:ToStringStyleAppend to the
toStringanObjectvalue, printing the full detail of theObject.- Overrides:
appendDetailin classToStringStyle- Parameters:
buffer- theStringBufferto populatefieldName- the field name, typically not used as already appendedvalue- the value to add to thetoString, notnull
-
appendDetail
Description copied from class:ToStringStyleAppend to the
toStringaCollection.- Overrides:
appendDetailin classToStringStyle- Parameters:
buffer- theStringBufferto populatefieldName- the field name, typically not used as already appendedcoll- theCollectionto add to thetoString, notnull
-
appendDetail
Description copied from class:ToStringStyleAppend to the
toStringaMap.- Overrides:
appendDetailin classToStringStyle- Parameters:
buffer- theStringBufferto populatefieldName- the field name, typically not used as already appendedmap- theMapto add to thetoString, notnull
-
isJsonArray
-
isJsonObject
-
appendValueAsString
Appends the given String enclosed in double-quotes to the given StringBuffer.- Parameters:
buffer- the StringBuffer to append the value to.value- the value to append.
-
appendFieldStart
Description copied from class:ToStringStyleAppend to the
toStringthe field start.- Overrides:
appendFieldStartin classToStringStyle- Parameters:
buffer- theStringBufferto populatefieldName- the field name
-
readResolve
Ensure
Singletonafter serialization.- Returns:
- the singleton
-