Class StandardToStringStyle
- All Implemented Interfaces:
Serializable
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.
- Since:
- 1.0
- See Also:
-
Field Summary
Fields 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 TypeMethodDescriptionGets the array end text.Gets the array separator text.Gets the array start text.Gets the content end text.Gets the content start text.Gets the field name value separator text.Gets the field separator text.Gets the text to output whennullfound.Gets the end text to output when anObjectis output in summary mode.Gets the start text to output when anObjectis output in summary mode.booleanGets whether to output array content detail.booleanGets whether to use full detail when the caller doesn't specify.booleanGets whether the field separator should be added at the end of each buffer.booleanGets whether the field separator should be added at the start of each buffer.booleanGets whether to use the class name.booleanGets whether to use the field names passed in.booleanGets whether to use the identity hash code.booleanGets whether to output short or long class names.voidsetArrayContentDetail(boolean arrayContentDetail) Sets whether to output array content detail.voidsetArrayEnd(String arrayEnd) Sets the array end text.voidsetArraySeparator(String arraySeparator) Sets the array separator text.voidsetArrayStart(String arrayStart) Sets the array start text.voidsetContentEnd(String contentEnd) Sets the content end text.voidsetContentStart(String contentStart) Sets the content start text.voidsetDefaultFullDetail(boolean defaultFullDetail) Sets whether to use full detail when the caller doesn't specify.voidsetFieldNameValueSeparator(String fieldNameValueSeparator) Sets the field name value separator text.voidsetFieldSeparator(String fieldSeparator) Sets the field separator text.voidsetFieldSeparatorAtEnd(boolean fieldSeparatorAtEnd) Sets whether the field separator should be added at the end of each buffer.voidsetFieldSeparatorAtStart(boolean fieldSeparatorAtStart) Sets whether the field separator should be added at the start of each buffer.voidsetNullText(String nullText) Sets the text to output whennullfound.voidsetSizeEndText(String sizeEndText) voidsetSizeStartText(String sizeStartText) voidsetSummaryObjectEndText(String summaryObjectEndText) Sets the end text to output when anObjectis output in summary mode.voidsetSummaryObjectStartText(String summaryObjectStartText) Sets the start text to output when anObjectis output in summary mode.voidsetUseClassName(boolean useClassName) Sets whether to use the class name.voidsetUseFieldNames(boolean useFieldNames) Sets whether to use the field names passed in.voidsetUseIdentityHashCode(boolean useIdentityHashCode) Sets whether to use the identity hash code.voidsetUseShortClassName(boolean useShortClassName) Sets whether to output short or long class names.Methods inherited from class org.apache.commons.lang3.builder.ToStringStyle
append, append, append, append, append, append, append, append, append, append, append, append, append, append, append, append, append, append, appendEnd, appendStart, appendSuper, appendToString, getRegistry
-
Constructor Details
-
StandardToStringStyle
public StandardToStringStyle()Constructor.
-
-
Method Details
-
getArrayEnd
Gets the array end text.- Returns:
- the current array end text
-
getArraySeparator
Gets the array separator text.- Returns:
- the current array separator text
-
getArrayStart
Gets the array start text.- Returns:
- the current array start text
-
getContentEnd
Gets the content end text.- Returns:
- the current content end text
-
getContentStart
Gets the content start text.- Returns:
- the current content start text
-
getFieldNameValueSeparator
Gets the field name value separator text.- Returns:
- the current field name value separator text
-
getFieldSeparator
Gets the field separator text.- Returns:
- the current field separator text
-
getNullText
Gets the text to output whennullfound.- Returns:
- the current text to output when
nullfound
-
getSizeEndText
Gets the end text to output when aCollection,MaporArraysize is output.This is output after the size value.
- Returns:
- the current end of size text
-
getSizeStartText
Gets the text to output when aCollection,MaporArraysize is output.This is output before the size value.
- Returns:
- the current start of size text
-
getSummaryObjectEndText
Gets the end text to output when anObjectis output in summary mode.This is output after the size value.
- Returns:
- the current end of summary text
-
getSummaryObjectStartText
Gets the start text to output when anObjectis output in summary mode.This is output before the size value.
- Returns:
- the current start of summary text
-
isArrayContentDetail
public boolean isArrayContentDetail()Gets whether to output array content detail.- Returns:
- the current array content detail setting
-
isDefaultFullDetail
public boolean isDefaultFullDetail()Gets whether to use full detail when the caller doesn't specify.- Returns:
- the current defaultFullDetail flag
-
isFieldSeparatorAtEnd
public boolean isFieldSeparatorAtEnd()Gets whether the field separator should be added at the end of each buffer.- Returns:
- fieldSeparatorAtEnd flag
- Since:
- 2.0
-
isFieldSeparatorAtStart
public boolean isFieldSeparatorAtStart()Gets whether the field separator should be added at the start of each buffer.- Returns:
- the fieldSeparatorAtStart flag
- Since:
- 2.0
-
isUseClassName
public boolean isUseClassName()Gets whether to use the class name.- Returns:
- the current useClassName flag
-
isUseFieldNames
public boolean isUseFieldNames()Gets whether to use the field names passed in.- Returns:
- the current useFieldNames flag
-
isUseIdentityHashCode
public boolean isUseIdentityHashCode()Gets whether to use the identity hash code.- Returns:
- the current useIdentityHashCode flag
-
isUseShortClassName
public boolean isUseShortClassName()Gets whether to output short or long class names.- Returns:
- the current useShortClassName flag
- Since:
- 2.0
-
setArrayContentDetail
public void setArrayContentDetail(boolean arrayContentDetail) Sets whether to output array content detail.- Parameters:
arrayContentDetail- the new arrayContentDetail flag
-
setArrayEnd
Sets the array end text.nullis accepted, but will be converted to an empty String.- Parameters:
arrayEnd- the new array end text
-
setArraySeparator
Sets the array separator text.nullis accepted, but will be converted to an empty String.- Parameters:
arraySeparator- the new array separator text
-
setArrayStart
Sets the array start text.nullis accepted, but will be converted to an empty String.- Parameters:
arrayStart- the new array start text
-
setContentEnd
Sets the content end text.nullis accepted, but will be converted to an empty String.- Parameters:
contentEnd- the new content end text
-
setContentStart
Sets the content start text.nullis accepted, but will be converted to an empty String.- Parameters:
contentStart- the new content start text
-
setDefaultFullDetail
public void setDefaultFullDetail(boolean defaultFullDetail) Sets whether to use full detail when the caller doesn't specify.- Parameters:
defaultFullDetail- the new defaultFullDetail flag
-
setFieldNameValueSeparator
Sets the field name value separator text.nullis accepted, but will be converted to an empty String.- Parameters:
fieldNameValueSeparator- the new field name value separator text
-
setFieldSeparator
Sets the field separator text.nullis accepted, but will be converted to an empty String.- Parameters:
fieldSeparator- the new field separator text
-
setFieldSeparatorAtEnd
public void setFieldSeparatorAtEnd(boolean fieldSeparatorAtEnd) Sets whether the field separator should be added at the end of each buffer.- Parameters:
fieldSeparatorAtEnd- the fieldSeparatorAtEnd flag- Since:
- 2.0
-
setFieldSeparatorAtStart
public void setFieldSeparatorAtStart(boolean fieldSeparatorAtStart) Sets whether the field separator should be added at the start of each buffer.- Parameters:
fieldSeparatorAtStart- the fieldSeparatorAtStart flag- Since:
- 2.0
-
setNullText
Sets the text to output whennullfound.nullis accepted, but will be converted to an empty String.- Parameters:
nullText- the new text to output whennullfound
-
setSizeEndText
Sets the end text to output when aCollection,MaporArraysize is output.This is output after the size value.
nullis accepted, but will be converted to an empty String.- Parameters:
sizeEndText- the new end of size text
-
setSizeStartText
Sets the start text to output when aCollection,MaporArraysize is output.This is output before the size value.
nullis accepted, but will be converted to an empty String.- Parameters:
sizeStartText- the new start of size text
-
setSummaryObjectEndText
Sets the end text to output when anObjectis output in summary mode.This is output after the size value.
nullis accepted, but will be converted to an empty String.- Parameters:
summaryObjectEndText- the new end of summary text
-
setSummaryObjectStartText
Sets the start text to output when anObjectis output in summary mode.This is output before the size value.
nullis accepted, but will be converted to an empty String.- Parameters:
summaryObjectStartText- the new start of summary text
-
setUseClassName
public void setUseClassName(boolean useClassName) Sets whether to use the class name.- Parameters:
useClassName- the new useClassName flag
-
setUseFieldNames
public void setUseFieldNames(boolean useFieldNames) Sets whether to use the field names passed in.- Parameters:
useFieldNames- the new useFieldNames flag
-
setUseIdentityHashCode
public void setUseIdentityHashCode(boolean useIdentityHashCode) Sets whether to use the identity hash code.- Parameters:
useIdentityHashCode- the new useIdentityHashCode flag
-
setUseShortClassName
public void setUseShortClassName(boolean useShortClassName) Sets whether to output short or long class names.- Parameters:
useShortClassName- the new useShortClassName flag- Since:
- 2.0
-