public class StandardToStringStyle extends ToStringStyle
Works with 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, MULTI_LINE_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 |
isShortClassName()
Deprecated.
Use
isUseShortClassName()
Method will be removed in Commons Lang 3.0. |
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 |
setShortClassName(boolean shortClassName)
Deprecated.
Use
setUseShortClassName(boolean)
Method will be removed in Commons Lang 3.0. |
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.
|
public boolean isUseClassName()
Gets whether to use the class name.
public void setUseClassName(boolean useClassName)
Sets whether to use the class name.
useClassName
- the new useClassName flagpublic boolean isUseShortClassName()
Gets whether to output short or long class names.
public boolean isShortClassName()
isUseShortClassName()
Method will be removed in Commons Lang 3.0.Gets whether to output short or long class names.
public void setUseShortClassName(boolean useShortClassName)
Sets whether to output short or long class names.
useShortClassName
- the new useShortClassName flagpublic void setShortClassName(boolean shortClassName)
setUseShortClassName(boolean)
Method will be removed in Commons Lang 3.0.Sets whether to output short or long class names.
shortClassName
- the new shortClassName flagpublic boolean isUseIdentityHashCode()
Gets whether to use the identity hash code.
public void setUseIdentityHashCode(boolean useIdentityHashCode)
Sets whether to use the identity hash code.
useIdentityHashCode
- the new useIdentityHashCode flagpublic boolean isUseFieldNames()
Gets whether to use the field names passed in.
public void setUseFieldNames(boolean useFieldNames)
Sets whether to use the field names passed in.
useFieldNames
- the new useFieldNames flagpublic boolean isDefaultFullDetail()
Gets whether to use full detail when the caller doesn't specify.
public void setDefaultFullDetail(boolean defaultFullDetail)
Sets whether to use full detail when the caller doesn't specify.
defaultFullDetail
- the new defaultFullDetail flagpublic boolean isArrayContentDetail()
Gets whether to output array content detail.
public void setArrayContentDetail(boolean arrayContentDetail)
Sets whether to output array content detail.
arrayContentDetail
- the new arrayContentDetail flagpublic java.lang.String getArrayStart()
Gets the array start text.
public void setArrayStart(java.lang.String arrayStart)
Sets the array start text.
null
is accepted, but will be converted
to an empty String.
arrayStart
- the new array start textpublic java.lang.String getArrayEnd()
Gets the array end text.
public void setArrayEnd(java.lang.String arrayEnd)
Sets the array end text.
null
is accepted, but will be converted
to an empty String.
arrayEnd
- the new array end textpublic java.lang.String getArraySeparator()
Gets the array separator text.
public void setArraySeparator(java.lang.String arraySeparator)
Sets the array separator text.
null
is accepted, but will be converted
to an empty String.
arraySeparator
- the new array separator textpublic java.lang.String getContentStart()
Gets the content start text.
public void setContentStart(java.lang.String contentStart)
Sets the content start text.
null
is accepted, but will be converted
to an empty String.
contentStart
- the new content start textpublic java.lang.String getContentEnd()
Gets the content end text.
public void setContentEnd(java.lang.String contentEnd)
Sets the content end text.
null
is accepted, but will be converted
to an empty String.
contentEnd
- the new content end textpublic java.lang.String getFieldNameValueSeparator()
Gets the field name value separator text.
public void setFieldNameValueSeparator(java.lang.String fieldNameValueSeparator)
Sets the field name value separator text.
null
is accepted, but will be converted
to an empty String.
fieldNameValueSeparator
- the new field name value separator textpublic java.lang.String getFieldSeparator()
Gets the field separator text.
public void setFieldSeparator(java.lang.String fieldSeparator)
Sets the field separator text.
null
is accepted, but will be converted
to an empty String.
fieldSeparator
- the new field separator textpublic boolean isFieldSeparatorAtStart()
Gets whether the field separator should be added at the start of each buffer.
public void setFieldSeparatorAtStart(boolean fieldSeparatorAtStart)
Sets whether the field separator should be added at the start of each buffer.
fieldSeparatorAtStart
- the fieldSeparatorAtStart flagpublic boolean isFieldSeparatorAtEnd()
Gets whether the field separator should be added at the end of each buffer.
public void setFieldSeparatorAtEnd(boolean fieldSeparatorAtEnd)
Sets whether the field separator should be added at the end of each buffer.
fieldSeparatorAtEnd
- the fieldSeparatorAtEnd flagpublic java.lang.String getNullText()
Gets the text to output when null
found.
null
foundpublic void setNullText(java.lang.String nullText)
Sets the text to output when 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()
Gets the text to output when a Collection
,
Map
or Array
size is output.
This is output before the size value.
public void setSizeStartText(java.lang.String sizeStartText)
Sets the start text to output when a 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)
Sets the end text to output when a 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()
Gets the start text to output when an Object
is
output in summary mode.
This is output before the size value.
public void setSummaryObjectStartText(java.lang.String summaryObjectStartText)
Sets the start text to output when an 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()
Gets the end text to output when an Object
is
output in summary mode.
This is output after the size value.
public void setSummaryObjectEndText(java.lang.String summaryObjectEndText)
Sets the end text to output when an 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 - 2020 Adobe. All Rights Reserved