Package org.apache.commons.lang3.builder
Class ToStringStyle.JsonToStringStyle
java.lang.Object
org.apache.commons.lang3.builder.ToStringStyle
org.apache.commons.lang3.builder.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) Appends to thetoStringabooleanarray.voidappend(StringBuffer buffer, String fieldName, byte[] array, Boolean fullDetail) Appends to thetoStringabytearray.voidappend(StringBuffer buffer, String fieldName, char[] array, Boolean fullDetail) Appends to thetoStringachararray.voidappend(StringBuffer buffer, String fieldName, double[] array, Boolean fullDetail) Appends to thetoStringadoublearray.voidappend(StringBuffer buffer, String fieldName, float[] array, Boolean fullDetail) Appends to thetoStringafloatarray.voidappend(StringBuffer buffer, String fieldName, int[] array, Boolean fullDetail) Appends to thetoStringanintarray.voidappend(StringBuffer buffer, String fieldName, long[] array, Boolean fullDetail) Appends to thetoStringalongarray.voidappend(StringBuffer buffer, String fieldName, short[] array, Boolean fullDetail) Appends to thetoStringashortarray.voidappend(StringBuffer buffer, String fieldName, Object[] array, Boolean fullDetail) Appends to thetoStringanObjectarray.voidappend(StringBuffer buffer, String fieldName, Object value, Boolean fullDetail) protected voidappendDetail(StringBuffer buffer, String fieldName, char value) Appends to thetoStringacharvalue.protected voidappendDetail(StringBuffer buffer, String fieldName, Object value) protected voidappendDetail(StringBuffer buffer, String fieldName, Collection<?> coll) Appends to thetoStringaCollection.protected voidappendDetail(StringBuffer buffer, String fieldName, Map<?, ?> map) Appends to thetoStringaMap.protected voidappendFieldStart(StringBuffer buffer, String fieldName) Appends to thetoStringthe field start.private voidappendValueAsString(StringBuffer buffer, String value) Appends the given String enclosed in double-quotes to the given StringBuffer.private voidcheckAppendInput(String fieldName, Boolean fullDetail) private voidcheckFieldName(String fieldName) private voidcheckIsFullDetail(Boolean fullDetail) private booleanisJsonArray(String valueAsString) private booleanisJsonObject(String valueAsString) private ObjectEnsure Singleton after 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()Constructs a new instance.Use the static constant rather than instantiating.
-
-
Method Details
-
append
Description copied from class:ToStringStyleAppends to thetoStringabooleanarray.- Overrides:
appendin classToStringStyle- Parameters:
buffer- theStringBufferto populate.fieldName- the field name.array- the array to add to the toString.fullDetail-truefor detail,falsefor summary info,nullfor style decides.
-
append
Description copied from class:ToStringStyleAppends to thetoStringabytearray.- Overrides:
appendin classToStringStyle- Parameters:
buffer- theStringBufferto populate.fieldName- the field name.array- the array to add to thetoString.fullDetail-truefor detail,falsefor summary info,nullfor style decides.
-
append
Description copied from class:ToStringStyleAppends to thetoStringachararray.- Overrides:
appendin classToStringStyle- Parameters:
buffer- theStringBufferto populate.fieldName- the field name.array- the array to add to thetoString.fullDetail-truefor detail,falsefor summary info,nullfor style decides.
-
append
Description copied from class:ToStringStyleAppends to thetoStringadoublearray.- Overrides:
appendin classToStringStyle- Parameters:
buffer- theStringBufferto populate.fieldName- the field name.array- the array to add to the toString.fullDetail-truefor detail,falsefor summary info,nullfor style decides.
-
append
Description copied from class:ToStringStyleAppends to thetoStringafloatarray.- Overrides:
appendin classToStringStyle- Parameters:
buffer- theStringBufferto populate.fieldName- the field name.array- the array to add to the toString.fullDetail-truefor detail,falsefor summary info,nullfor style decides.
-
append
Description copied from class:ToStringStyleAppends to thetoStringanintarray.- Overrides:
appendin classToStringStyle- Parameters:
buffer- theStringBufferto populate.fieldName- the field name.array- the array to add to thetoString.fullDetail-truefor detail,falsefor summary info,nullfor style decides.
-
append
Description copied from class:ToStringStyleAppends to thetoStringalongarray.- Overrides:
appendin classToStringStyle- Parameters:
buffer- theStringBufferto populate.fieldName- the field name.array- the array to add to thetoString.fullDetail-truefor detail,falsefor summary info,nullfor style decides.
-
append
Description copied from class:ToStringStyle- Overrides:
appendin classToStringStyle- Parameters:
buffer- theStringBufferto populate.fieldName- the field name.value- the value to add to thetoString.fullDetail-truefor detail,falsefor summary info,nullfor style decides.
-
append
Description copied from class:ToStringStyleAppends to thetoStringanObjectarray.- Overrides:
appendin classToStringStyle- Parameters:
buffer- theStringBufferto populate.fieldName- the field name.array- the array to add to the toString.fullDetail-truefor detail,falsefor summary info,nullfor style decides.
-
append
Description copied from class:ToStringStyleAppends to thetoStringashortarray.- Overrides:
appendin classToStringStyle- Parameters:
buffer- theStringBufferto populate.fieldName- the field name.array- the array to add to thetoString.fullDetail-truefor detail,falsefor summary info,nullfor style decides.
-
appendDetail
Description copied from class:ToStringStyleAppends to thetoStringacharvalue.- Overrides:
appendDetailin classToStringStyle- Parameters:
buffer- theStringBufferto populate.fieldName- the field name, typically not used as already appended.value- the value to add to thetoString.
-
appendDetail
Description copied from class:ToStringStyleAppends to thetoStringaCollection.- Overrides:
appendDetailin classToStringStyle- Parameters:
buffer- theStringBufferto populate.fieldName- the field name, typically not used as already appended.coll- theCollectionto add to thetoString, notnull.
-
appendDetail
Description copied from class:ToStringStyleAppends to thetoStringaMap.- Overrides:
appendDetailin classToStringStyle- Parameters:
buffer- theStringBufferto populate.fieldName- the field name, typically not used as already appended.map- theMapto add to thetoString, notnull.
-
appendDetail
Description copied from class:ToStringStyle- Overrides:
appendDetailin classToStringStyle- Parameters:
buffer- theStringBufferto populate.fieldName- the field name, typically not used as already appended.value- the value to add to thetoString, notnull.
-
appendFieldStart
Description copied from class:ToStringStyleAppends to thetoStringthe field start.- Overrides:
appendFieldStartin classToStringStyle- Parameters:
buffer- theStringBufferto populate.fieldName- the field name.
-
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.
-
checkAppendInput
-
checkFieldName
-
checkIsFullDetail
-
isJsonArray
-
isJsonObject
-
readResolve
Ensure Singleton after serialization.- Returns:
- the singleton
-