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 |
---|---|
java.lang.String |
getArrayEnd()
Gets the array end text.
|
java.lang.String |
getArraySeparator()
Gets the array separator text.
|
java.lang.String |
getArrayStart()
Gets the array start text.
|
java.lang.String |
getContentEnd()
Gets the content end text.
|
java.lang.String |
getContentStart()
Gets the content start text.
|
java.lang.String |
getFieldNameValueSeparator()
Gets the field name value separator text.
|
java.lang.String |
getFieldSeparator()
Gets the field separator text.
|
java.lang.String |
getNullText()
Gets the text to output when
null found. |
java.lang.String |
getSizeEndText()
Gets the end text to output when a
Collection ,
Map or Array size is output. |
java.lang.String |
getSizeStartText()
Gets the text to output when a
Collection ,
Map or Array size is output. |
java.lang.String |
getSummaryObjectEndText()
Gets the end text to output when an
Object is
output in summary mode. |
java.lang.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(java.lang.String arrayEnd)
Sets the array end text.
|
void |
setArraySeparator(java.lang.String arraySeparator)
Sets the array separator text.
|
void |
setArrayStart(java.lang.String arrayStart)
Sets the array start text.
|
void |
setContentEnd(java.lang.String contentEnd)
Sets the content end text.
|
void |
setContentStart(java.lang.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(java.lang.String fieldNameValueSeparator)
Sets the field name value separator text.
|
void |
setFieldSeparator(java.lang.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(java.lang.String nullText)
Sets the text to output when
null found. |
void |
setSizeEndText(java.lang.String sizeEndText)
Sets the end text to output when a
Collection ,
Map or Array size is output. |
void |
setSizeStartText(java.lang.String sizeStartText)
Sets the start text to output when a
Collection ,
Map or Array size is output. |
void |
setSummaryObjectEndText(java.lang.String summaryObjectEndText)
Sets the end text to output when an
Object is
output in summary mode. |
void |
setSummaryObjectStartText(java.lang.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, appendEnd, appendStart, appendSuper, appendToString, getRegistry
public boolean isUseClassName()
public void setUseClassName(boolean useClassName)
useClassName
- the new useClassName flagpublic boolean isUseShortClassName()
public void setUseShortClassName(boolean useShortClassName)
useShortClassName
- the new useShortClassName flagpublic boolean isUseIdentityHashCode()
public void setUseIdentityHashCode(boolean useIdentityHashCode)
useIdentityHashCode
- the new useIdentityHashCode flagpublic boolean isUseFieldNames()
public void setUseFieldNames(boolean useFieldNames)
useFieldNames
- the new useFieldNames flagpublic boolean isDefaultFullDetail()
public void setDefaultFullDetail(boolean defaultFullDetail)
defaultFullDetail
- the new defaultFullDetail flagpublic boolean isArrayContentDetail()
public void setArrayContentDetail(boolean arrayContentDetail)
arrayContentDetail
- the new arrayContentDetail flagpublic java.lang.String getArrayStart()
public void setArrayStart(java.lang.String arrayStart)
null
is accepted, but will be converted
to an empty String.
arrayStart
- the new array start textpublic java.lang.String getArrayEnd()
public void setArrayEnd(java.lang.String arrayEnd)
null
is accepted, but will be converted
to an empty String.
arrayEnd
- the new array end textpublic java.lang.String getArraySeparator()
public void setArraySeparator(java.lang.String arraySeparator)
null
is accepted, but will be converted
to an empty String.
arraySeparator
- the new array separator textpublic java.lang.String getContentStart()
public void setContentStart(java.lang.String contentStart)
null
is accepted, but will be converted
to an empty String.
contentStart
- the new content start textpublic java.lang.String getContentEnd()
public void setContentEnd(java.lang.String contentEnd)
null
is accepted, but will be converted
to an empty String.
contentEnd
- the new content end textpublic java.lang.String getFieldNameValueSeparator()
public void setFieldNameValueSeparator(java.lang.String fieldNameValueSeparator)
null
is accepted, but will be converted
to an empty String.
fieldNameValueSeparator
- the new field name value separator textpublic java.lang.String getFieldSeparator()
public void setFieldSeparator(java.lang.String fieldSeparator)
null
is accepted, but will be converted
to an empty String.
fieldSeparator
- the new field separator textpublic boolean isFieldSeparatorAtStart()
public void setFieldSeparatorAtStart(boolean fieldSeparatorAtStart)
fieldSeparatorAtStart
- the fieldSeparatorAtStart flagpublic boolean isFieldSeparatorAtEnd()
public void setFieldSeparatorAtEnd(boolean fieldSeparatorAtEnd)
fieldSeparatorAtEnd
- the fieldSeparatorAtEnd flagpublic java.lang.String getNullText()
null
found.null
foundpublic void setNullText(java.lang.String nullText)
null
found.
null
is accepted, but will be converted
to an empty String.
nullText
- the new text to output when null
foundpublic java.lang.String getSizeStartText()
Collection
,
Map
or Array
size is output.
This is output before the size value.
public void setSizeStartText(java.lang.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.
sizeStartText
- the new start of size textpublic java.lang.String getSizeEndText()
Collection
,
Map
or Array
size is output.
This is output after the size value.
public void setSizeEndText(java.lang.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.
sizeEndText
- the new end of size textpublic java.lang.String getSummaryObjectStartText()
Object
is
output in summary mode.
This is output before the size value.
public void setSummaryObjectStartText(java.lang.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.
summaryObjectStartText
- the new start of summary textpublic java.lang.String getSummaryObjectEndText()
Object
is
output in summary mode.
This is output after the size value.
public void setSummaryObjectEndText(java.lang.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.
summaryObjectEndText
- the new end of summary textCopyright © 2010 - 2023 Adobe. All Rights Reserved