public class StandardToStringStyle extends ToStringStyle
ToStringBuilder
to create a toString
.
This class is intended to be used as a singleton. There is no need to instantiate a new style each time. Simply instantiate the class once, customize the values as required, and store the result in a public static final variable for the rest of the program to access.
DEFAULT_STYLE, JSON_STYLE, MULTI_LINE_STYLE, NO_CLASS_NAME_STYLE, NO_FIELD_NAMES_STYLE, SHORT_PREFIX_STYLE, SIMPLE_STYLE
Constructor and Description |
---|
StandardToStringStyle()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
String |
getArrayEnd()
Gets the array end text.
|
String |
getArraySeparator()
Gets the array separator text.
|
String |
getArrayStart()
Gets the array start text.
|
String |
getContentEnd()
Gets the content end text.
|
String |
getContentStart()
Gets the content start text.
|
String |
getFieldNameValueSeparator()
Gets the field name value separator text.
|
String |
getFieldSeparator()
Gets the field separator text.
|
String |
getNullText()
Gets the text to output when
null found. |
String |
getSizeEndText()
|
String |
getSizeStartText()
|
String |
getSummaryObjectEndText()
Gets the end text to output when an
Object is
output in summary mode. |
String |
getSummaryObjectStartText()
Gets the start text to output when an
Object is
output in summary mode. |
boolean |
isArrayContentDetail()
Gets whether to output array content detail.
|
boolean |
isDefaultFullDetail()
Gets whether to use full detail when the caller doesn't
specify.
|
boolean |
isFieldSeparatorAtEnd()
Gets whether the field separator should be added at the end
of each buffer.
|
boolean |
isFieldSeparatorAtStart()
Gets whether the field separator should be added at the start
of each buffer.
|
boolean |
isUseClassName()
Gets whether to use the class name.
|
boolean |
isUseFieldNames()
Gets whether to use the field names passed in.
|
boolean |
isUseIdentityHashCode()
Gets whether to use the identity hash code.
|
boolean |
isUseShortClassName()
Gets whether to output short or long class names.
|
void |
setArrayContentDetail(boolean arrayContentDetail)
Sets whether to output array content detail.
|
void |
setArrayEnd(String arrayEnd)
Sets the array end text.
|
void |
setArraySeparator(String arraySeparator)
Sets the array separator text.
|
void |
setArrayStart(String arrayStart)
Sets the array start text.
|
void |
setContentEnd(String contentEnd)
Sets the content end text.
|
void |
setContentStart(String contentStart)
Sets the content start text.
|
void |
setDefaultFullDetail(boolean defaultFullDetail)
Sets whether to use full detail when the caller doesn't
specify.
|
void |
setFieldNameValueSeparator(String fieldNameValueSeparator)
Sets the field name value separator text.
|
void |
setFieldSeparator(String fieldSeparator)
Sets the field separator text.
|
void |
setFieldSeparatorAtEnd(boolean fieldSeparatorAtEnd)
Sets whether the field separator should be added at the end
of each buffer.
|
void |
setFieldSeparatorAtStart(boolean fieldSeparatorAtStart)
Sets whether the field separator should be added at the start
of each buffer.
|
void |
setNullText(String nullText)
Sets the text to output when
null found. |
void |
setSizeEndText(String sizeEndText)
|
void |
setSizeStartText(String sizeStartText)
|
void |
setSummaryObjectEndText(String summaryObjectEndText)
Sets the end text to output when an
Object is
output in summary mode. |
void |
setSummaryObjectStartText(String summaryObjectStartText)
Sets the start text to output when an
Object is
output in summary mode. |
void |
setUseClassName(boolean useClassName)
Sets whether to use the class name.
|
void |
setUseFieldNames(boolean useFieldNames)
Sets whether to use the field names passed in.
|
void |
setUseIdentityHashCode(boolean useIdentityHashCode)
Sets whether to use the identity hash code.
|
void |
setUseShortClassName(boolean useShortClassName)
Sets whether to output short or long class names.
|
append, 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, appendDetail, appendDetail, appendDetail, 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, getRegistry, getShortClassName, isFullDetail, reflectionAppendArrayDetail, removeLastFieldSeparator
public StandardToStringStyle()
public String getArrayEnd()
getArrayEnd
in class ToStringStyle
public String getArraySeparator()
getArraySeparator
in class ToStringStyle
public String getArrayStart()
getArrayStart
in class ToStringStyle
public String getContentEnd()
getContentEnd
in class ToStringStyle
public String getContentStart()
getContentStart
in class ToStringStyle
public String getFieldNameValueSeparator()
getFieldNameValueSeparator
in class ToStringStyle
public String getFieldSeparator()
getFieldSeparator
in class ToStringStyle
public String getNullText()
null
found.getNullText
in class ToStringStyle
null
foundpublic String getSizeEndText()
Collection
,
Map
or Array
size is output.
This is output after the size value.
getSizeEndText
in class ToStringStyle
public String getSizeStartText()
Collection
,
Map
or Array
size is output.
This is output before the size value.
getSizeStartText
in class ToStringStyle
public String getSummaryObjectEndText()
Object
is
output in summary mode.
This is output after the size value.
getSummaryObjectEndText
in class ToStringStyle
public String getSummaryObjectStartText()
Object
is
output in summary mode.
This is output before the size value.
getSummaryObjectStartText
in class ToStringStyle
public boolean isArrayContentDetail()
isArrayContentDetail
in class ToStringStyle
public boolean isDefaultFullDetail()
isDefaultFullDetail
in class ToStringStyle
public boolean isFieldSeparatorAtEnd()
isFieldSeparatorAtEnd
in class ToStringStyle
public boolean isFieldSeparatorAtStart()
isFieldSeparatorAtStart
in class ToStringStyle
public boolean isUseClassName()
isUseClassName
in class ToStringStyle
public boolean isUseFieldNames()
isUseFieldNames
in class ToStringStyle
public boolean isUseIdentityHashCode()
isUseIdentityHashCode
in class ToStringStyle
public boolean isUseShortClassName()
isUseShortClassName
in class ToStringStyle
public void setArrayContentDetail(boolean arrayContentDetail)
setArrayContentDetail
in class ToStringStyle
arrayContentDetail
- the new arrayContentDetail flagpublic void setArrayEnd(String arrayEnd)
null
is accepted, but will be converted
to an empty String.
setArrayEnd
in class ToStringStyle
arrayEnd
- the new array end textpublic void setArraySeparator(String arraySeparator)
null
is accepted, but will be converted
to an empty String.
setArraySeparator
in class ToStringStyle
arraySeparator
- the new array separator textpublic void setArrayStart(String arrayStart)
null
is accepted, but will be converted
to an empty String.
setArrayStart
in class ToStringStyle
arrayStart
- the new array start textpublic void setContentEnd(String contentEnd)
null
is accepted, but will be converted
to an empty String.
setContentEnd
in class ToStringStyle
contentEnd
- the new content end textpublic void setContentStart(String contentStart)
null
is accepted, but will be converted
to an empty String.
setContentStart
in class ToStringStyle
contentStart
- the new content start textpublic void setDefaultFullDetail(boolean defaultFullDetail)
setDefaultFullDetail
in class ToStringStyle
defaultFullDetail
- the new defaultFullDetail flagpublic void setFieldNameValueSeparator(String fieldNameValueSeparator)
null
is accepted, but will be converted
to an empty String.
setFieldNameValueSeparator
in class ToStringStyle
fieldNameValueSeparator
- the new field name value separator textpublic void setFieldSeparator(String fieldSeparator)
null
is accepted, but will be converted
to an empty String.
setFieldSeparator
in class ToStringStyle
fieldSeparator
- the new field separator textpublic void setFieldSeparatorAtEnd(boolean fieldSeparatorAtEnd)
setFieldSeparatorAtEnd
in class ToStringStyle
fieldSeparatorAtEnd
- the fieldSeparatorAtEnd flagpublic void setFieldSeparatorAtStart(boolean fieldSeparatorAtStart)
setFieldSeparatorAtStart
in class ToStringStyle
fieldSeparatorAtStart
- the fieldSeparatorAtStart flagpublic void setNullText(String nullText)
null
found.
null
is accepted, but will be converted
to an empty String.
setNullText
in class ToStringStyle
nullText
- the new text to output when null
foundpublic void setSizeEndText(String sizeEndText)
Collection
,
Map
or Array
size is output.
This is output after the size value.
null
is accepted, but will be converted
to an empty String.
setSizeEndText
in class ToStringStyle
sizeEndText
- the new end of size textpublic void setSizeStartText(String sizeStartText)
Collection
,
Map
or Array
size is output.
This is output before the size value.
null
is accepted, but will be converted to
an empty String.
setSizeStartText
in class ToStringStyle
sizeStartText
- the new start of size textpublic void setSummaryObjectEndText(String summaryObjectEndText)
Object
is
output in summary mode.
This is output after the size value.
null
is accepted, but will be converted to
an empty String.
setSummaryObjectEndText
in class ToStringStyle
summaryObjectEndText
- the new end of summary textpublic void setSummaryObjectStartText(String summaryObjectStartText)
Object
is
output in summary mode.
This is output before the size value.
null
is accepted, but will be converted to
an empty String.
setSummaryObjectStartText
in class ToStringStyle
summaryObjectStartText
- the new start of summary textpublic void setUseClassName(boolean useClassName)
setUseClassName
in class ToStringStyle
useClassName
- the new useClassName flagpublic void setUseFieldNames(boolean useFieldNames)
setUseFieldNames
in class ToStringStyle
useFieldNames
- the new useFieldNames flagpublic void setUseIdentityHashCode(boolean useIdentityHashCode)
setUseIdentityHashCode
in class ToStringStyle
useIdentityHashCode
- the new useIdentityHashCode flagpublic void setUseShortClassName(boolean useShortClassName)
setUseShortClassName
in class ToStringStyle
useShortClassName
- the new useShortClassName flagCopyright © 2001–2023 The Apache Software Foundation. All rights reserved.