Class StandardToStringStyle
- All Implemented Interfaces:
Serializable
ToStringBuilder创建toString
这个类是作为单例对象使用的。没有必要每次都实例化一个新样式。 只需实例化一次, 根据需要自定义值,并将结果存储在公共静态final变量中,供程序的其余部分访问.
- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Field Summary
Fields inherited from class org.aoju.bus.core.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 aCollection,Mapor array size is output.Gets the start text to output when aCollection,Mapor array size is output.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) Sets the end text to output when aCollection,Mapor array size is output.voidsetSizeStartText(String sizeStartText) Sets the start text to output when aCollection,Mapor array size is output.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.aoju.bus.core.builder.ToStringStyle
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, appendEnd, appendFieldEnd, appendFieldSeparator, appendFieldStart, appendIdentityHashCode, appendInternal, appendNullText, appendStart, appendSummary, appendSummary, appendSummary, appendSummary, appendSummary, appendSummary, appendSummary, appendSummary, appendSummary, appendSummary, appendSummarySize, appendSuper, appendToString, getShortClassName, isFullDetail, reflectionAppendArrayDetail, removeLastFieldSeparator
-
Constructor Details
-
StandardToStringStyle
public StandardToStringStyle()
-
-
Method Details
-
isUseClassName
public boolean isUseClassName()Description copied from class:ToStringStyleGets whether to use the class name.
- Overrides:
isUseClassNamein classToStringStyle- Returns:
- the current useClassName flag
-
setUseClassName
public void setUseClassName(boolean useClassName) Description copied from class:ToStringStyleSets whether to use the class name.
- Overrides:
setUseClassNamein classToStringStyle- Parameters:
useClassName- the new useClassName flag
-
isUseShortClassName
public boolean isUseShortClassName()Description copied from class:ToStringStyleGets whether to output short or long class names.
- Overrides:
isUseShortClassNamein classToStringStyle- Returns:
- the current useShortClassName flag
-
setUseShortClassName
public void setUseShortClassName(boolean useShortClassName) Description copied from class:ToStringStyleSets whether to output short or long class names.
- Overrides:
setUseShortClassNamein classToStringStyle- Parameters:
useShortClassName- the new useShortClassName flag
-
isUseIdentityHashCode
public boolean isUseIdentityHashCode()Description copied from class:ToStringStyleGets whether to use the identity hash code.
- Overrides:
isUseIdentityHashCodein classToStringStyle- Returns:
- the current useIdentityHashCode flag
-
setUseIdentityHashCode
public void setUseIdentityHashCode(boolean useIdentityHashCode) Description copied from class:ToStringStyleSets whether to use the identity hash code.
- Overrides:
setUseIdentityHashCodein classToStringStyle- Parameters:
useIdentityHashCode- the new useIdentityHashCode flag
-
isUseFieldNames
public boolean isUseFieldNames()Description copied from class:ToStringStyleGets whether to use the field names passed in.
- Overrides:
isUseFieldNamesin classToStringStyle- Returns:
- the current useFieldNames flag
-
setUseFieldNames
public void setUseFieldNames(boolean useFieldNames) Description copied from class:ToStringStyleSets whether to use the field names passed in.
- Overrides:
setUseFieldNamesin classToStringStyle- Parameters:
useFieldNames- the new useFieldNames flag
-
isDefaultFullDetail
public boolean isDefaultFullDetail()Description copied from class:ToStringStyleGets whether to use full detail when the caller doesn't specify.
- Overrides:
isDefaultFullDetailin classToStringStyle- Returns:
- the current defaultFullDetail flag
-
setDefaultFullDetail
public void setDefaultFullDetail(boolean defaultFullDetail) Description copied from class:ToStringStyleSets whether to use full detail when the caller doesn't specify.
- Overrides:
setDefaultFullDetailin classToStringStyle- Parameters:
defaultFullDetail- the new defaultFullDetail flag
-
isArrayContentDetail
public boolean isArrayContentDetail()Description copied from class:ToStringStyleGets whether to output array content detail.
- Overrides:
isArrayContentDetailin classToStringStyle- Returns:
- the current array content detail setting
-
setArrayContentDetail
public void setArrayContentDetail(boolean arrayContentDetail) Description copied from class:ToStringStyleSets whether to output array content detail.
- Overrides:
setArrayContentDetailin classToStringStyle- Parameters:
arrayContentDetail- the new arrayContentDetail flag
-
getArrayStart
Description copied from class:ToStringStyleGets the array start text.
- Overrides:
getArrayStartin classToStringStyle- Returns:
- the current array start text
-
setArrayStart
Description copied from class:ToStringStyleSets the array start text.
nullis accepted, but will be converted to an empty String.- Overrides:
setArrayStartin classToStringStyle- Parameters:
arrayStart- the new array start text
-
getArrayEnd
Description copied from class:ToStringStyleGets the array end text.
- Overrides:
getArrayEndin classToStringStyle- Returns:
- the current array end text
-
setArrayEnd
Description copied from class:ToStringStyleSets the array end text.
nullis accepted, but will be converted to an empty String.- Overrides:
setArrayEndin classToStringStyle- Parameters:
arrayEnd- the new array end text
-
getArraySeparator
Description copied from class:ToStringStyleGets the array separator text.
- Overrides:
getArraySeparatorin classToStringStyle- Returns:
- the current array separator text
-
setArraySeparator
Description copied from class:ToStringStyleSets the array separator text.
nullis accepted, but will be converted to an empty String.- Overrides:
setArraySeparatorin classToStringStyle- Parameters:
arraySeparator- the new array separator text
-
getContentStart
Description copied from class:ToStringStyleGets the content start text.
- Overrides:
getContentStartin classToStringStyle- Returns:
- the current content start text
-
setContentStart
Description copied from class:ToStringStyleSets the content start text.
nullis accepted, but will be converted to an empty String.- Overrides:
setContentStartin classToStringStyle- Parameters:
contentStart- the new content start text
-
getContentEnd
Description copied from class:ToStringStyleGets the content end text.
- Overrides:
getContentEndin classToStringStyle- Returns:
- the current content end text
-
setContentEnd
Description copied from class:ToStringStyleSets the content end text.
nullis accepted, but will be converted to an empty String.- Overrides:
setContentEndin classToStringStyle- Parameters:
contentEnd- the new content end text
-
getFieldNameValueSeparator
Description copied from class:ToStringStyleGets the field name value separator text.
- Overrides:
getFieldNameValueSeparatorin classToStringStyle- Returns:
- the current field name value separator text
-
setFieldNameValueSeparator
Description copied from class:ToStringStyleSets the field name value separator text.
nullis accepted, but will be converted to an empty String.- Overrides:
setFieldNameValueSeparatorin classToStringStyle- Parameters:
fieldNameValueSeparator- the new field name value separator text
-
getFieldSeparator
Description copied from class:ToStringStyleGets the field separator text.
- Overrides:
getFieldSeparatorin classToStringStyle- Returns:
- the current field separator text
-
setFieldSeparator
Description copied from class:ToStringStyleSets the field separator text.
nullis accepted, but will be converted to an empty String.- Overrides:
setFieldSeparatorin classToStringStyle- Parameters:
fieldSeparator- the new field separator text
-
isFieldSeparatorAtStart
public boolean isFieldSeparatorAtStart()Description copied from class:ToStringStyleGets whether the field separator should be added at the start of each buffer.
- Overrides:
isFieldSeparatorAtStartin classToStringStyle- Returns:
- the fieldSeparatorAtStart flag
-
setFieldSeparatorAtStart
public void setFieldSeparatorAtStart(boolean fieldSeparatorAtStart) Description copied from class:ToStringStyleSets whether the field separator should be added at the start of each buffer.
- Overrides:
setFieldSeparatorAtStartin classToStringStyle- Parameters:
fieldSeparatorAtStart- the fieldSeparatorAtStart flag
-
isFieldSeparatorAtEnd
public boolean isFieldSeparatorAtEnd()Description copied from class:ToStringStyleGets whether the field separator should be added at the end of each buffer.
- Overrides:
isFieldSeparatorAtEndin classToStringStyle- Returns:
- fieldSeparatorAtEnd flag
-
setFieldSeparatorAtEnd
public void setFieldSeparatorAtEnd(boolean fieldSeparatorAtEnd) Description copied from class:ToStringStyleSets whether the field separator should be added at the end of each buffer.
- Overrides:
setFieldSeparatorAtEndin classToStringStyle- Parameters:
fieldSeparatorAtEnd- the fieldSeparatorAtEnd flag
-
getNullText
Description copied from class:ToStringStyleGets the text to output when
nullfound.- Overrides:
getNullTextin classToStringStyle- Returns:
- the current text to output when null found
-
setNullText
Description copied from class:ToStringStyleSets the text to output when
nullfound.nullis accepted, but will be converted to an empty String.- Overrides:
setNullTextin classToStringStyle- Parameters:
nullText- the new text to output when null found
-
getSizeStartText
Description copied from class:ToStringStyleGets the start text to output when a
Collection,Mapor array size is output.This is output before the size value.
- Overrides:
getSizeStartTextin classToStringStyle- Returns:
- the current start of size text
-
setSizeStartText
Description copied from class:ToStringStyleSets the start text to output when a
Collection,Mapor array size is output.This is output before the size value.
nullis accepted, but will be converted to an empty String.- Overrides:
setSizeStartTextin classToStringStyle- Parameters:
sizeStartText- the new start of size text
-
getSizeEndText
Description copied from class:ToStringStyleGets the end text to output when a
Collection,Mapor array size is output.This is output after the size value.
- Overrides:
getSizeEndTextin classToStringStyle- Returns:
- the current end of size text
-
setSizeEndText
Description copied from class:ToStringStyleSets the end text to output when a
Collection,Mapor array size is output.This is output after the size value.
nullis accepted, but will be converted to an empty String.- Overrides:
setSizeEndTextin classToStringStyle- Parameters:
sizeEndText- the new end of size text
-
getSummaryObjectStartText
Description copied from class:ToStringStyleGets the start text to output when an
Objectis output in summary mode.This is output before the size value.
- Overrides:
getSummaryObjectStartTextin classToStringStyle- Returns:
- the current start of summary text
-
setSummaryObjectStartText
Description copied from class:ToStringStyleSets the start text to output when an
Objectis output in summary mode.This is output before the size value.
nullis accepted, but will be converted to an empty String.- Overrides:
setSummaryObjectStartTextin classToStringStyle- Parameters:
summaryObjectStartText- the new start of summary text
-
getSummaryObjectEndText
Description copied from class:ToStringStyleGets the end text to output when an
Objectis output in summary mode.This is output after the size value.
- Overrides:
getSummaryObjectEndTextin classToStringStyle- Returns:
- the current end of summary text
-
setSummaryObjectEndText
Description copied from class:ToStringStyleSets the end text to output when an
Objectis output in summary mode.This is output after the size value.
nullis accepted, but will be converted to an empty String.- Overrides:
setSummaryObjectEndTextin classToStringStyle- Parameters:
summaryObjectEndText- the new end of summary text
-