public class StandardToStringStyle extends ToStringStyle
ToStringBuilder创建toString
这个类是作为单例对象使用的。没有必要每次都实例化一个新样式。 只需实例化一次, 根据需要自定义值,并将结果存储在公共静态final变量中,供程序的其余部分访问.
DEFAULT_STYLE, JSON_STYLE, MULTI_LINE_STYLE, NO_CLASS_NAME_STYLE, NO_FIELD_NAMES_STYLE, SHORT_PREFIX_STYLE, SIMPLE_STYLE| Constructor and Description |
|---|
StandardToStringStyle() |
| 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()
Gets the end text to output when a
Collection,
Map or array size is output. |
String |
getSizeStartText()
Gets the start text to output when a
Collection,
Map or array size is output. |
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)
Sets the end text to output when a
Collection,
Map or array size is output. |
void |
setSizeStartText(String sizeStartText)
Sets the start text to output when a
Collection,
Map or array size is output. |
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, appendEnd, appendFieldEnd, appendFieldSeparator, appendFieldStart, appendIdentityHashCode, appendInternal, appendNullText, appendStart, appendSummary, appendSummary, appendSummary, appendSummary, appendSummary, appendSummary, appendSummary, appendSummary, appendSummary, appendSummary, appendSummarySize, appendSuper, appendToString, getShortClassName, isFullDetail, reflectionAppendArrayDetail, removeLastFieldSeparatorpublic boolean isUseClassName()
ToStringStyleGets whether to use the class name.
isUseClassName in class ToStringStylepublic void setUseClassName(boolean useClassName)
ToStringStyleSets whether to use the class name.
setUseClassName in class ToStringStyleuseClassName - the new useClassName flagpublic boolean isUseShortClassName()
ToStringStyleGets whether to output short or long class names.
isUseShortClassName in class ToStringStylepublic void setUseShortClassName(boolean useShortClassName)
ToStringStyleSets whether to output short or long class names.
setUseShortClassName in class ToStringStyleuseShortClassName - the new useShortClassName flagpublic boolean isUseIdentityHashCode()
ToStringStyleGets whether to use the identity hash code.
isUseIdentityHashCode in class ToStringStylepublic void setUseIdentityHashCode(boolean useIdentityHashCode)
ToStringStyleSets whether to use the identity hash code.
setUseIdentityHashCode in class ToStringStyleuseIdentityHashCode - the new useIdentityHashCode flagpublic boolean isUseFieldNames()
ToStringStyleGets whether to use the field names passed in.
isUseFieldNames in class ToStringStylepublic void setUseFieldNames(boolean useFieldNames)
ToStringStyleSets whether to use the field names passed in.
setUseFieldNames in class ToStringStyleuseFieldNames - the new useFieldNames flagpublic boolean isDefaultFullDetail()
ToStringStyleGets whether to use full detail when the caller doesn't specify.
isDefaultFullDetail in class ToStringStylepublic void setDefaultFullDetail(boolean defaultFullDetail)
ToStringStyleSets whether to use full detail when the caller doesn't specify.
setDefaultFullDetail in class ToStringStyledefaultFullDetail - the new defaultFullDetail flagpublic boolean isArrayContentDetail()
ToStringStyleGets whether to output array content detail.
isArrayContentDetail in class ToStringStylepublic void setArrayContentDetail(boolean arrayContentDetail)
ToStringStyleSets whether to output array content detail.
setArrayContentDetail in class ToStringStylearrayContentDetail - the new arrayContentDetail flagpublic String getArrayStart()
ToStringStyleGets the array start text.
getArrayStart in class ToStringStylepublic void setArrayStart(String arrayStart)
ToStringStyleSets the array start text.
null is accepted, but will be converted to
an empty String.
setArrayStart in class ToStringStylearrayStart - the new array start textpublic String getArrayEnd()
ToStringStyleGets the array end text.
getArrayEnd in class ToStringStylepublic void setArrayEnd(String arrayEnd)
ToStringStyleSets the array end text.
null is accepted, but will be converted to
an empty String.
setArrayEnd in class ToStringStylearrayEnd - the new array end textpublic String getArraySeparator()
ToStringStyleGets the array separator text.
getArraySeparator in class ToStringStylepublic void setArraySeparator(String arraySeparator)
ToStringStyleSets the array separator text.
null is accepted, but will be converted to
an empty String.
setArraySeparator in class ToStringStylearraySeparator - the new array separator textpublic String getContentStart()
ToStringStyleGets the content start text.
getContentStart in class ToStringStylepublic void setContentStart(String contentStart)
ToStringStyleSets the content start text.
null is accepted, but will be converted to
an empty String.
setContentStart in class ToStringStylecontentStart - the new content start textpublic String getContentEnd()
ToStringStyleGets the content end text.
getContentEnd in class ToStringStylepublic void setContentEnd(String contentEnd)
ToStringStyleSets the content end text.
null is accepted, but will be converted to
an empty String.
setContentEnd in class ToStringStylecontentEnd - the new content end textpublic String getFieldNameValueSeparator()
ToStringStyleGets the field name value separator text.
getFieldNameValueSeparator in class ToStringStylepublic void setFieldNameValueSeparator(String fieldNameValueSeparator)
ToStringStyleSets the field name value separator text.
null is accepted, but will be converted to
an empty String.
setFieldNameValueSeparator in class ToStringStylefieldNameValueSeparator - the new field name value separator textpublic String getFieldSeparator()
ToStringStyleGets the field separator text.
getFieldSeparator in class ToStringStylepublic void setFieldSeparator(String fieldSeparator)
ToStringStyleSets the field separator text.
null is accepted, but will be converted to
an empty String.
setFieldSeparator in class ToStringStylefieldSeparator - the new field separator textpublic boolean isFieldSeparatorAtStart()
ToStringStyleGets whether the field separator should be added at the start of each buffer.
isFieldSeparatorAtStart in class ToStringStylepublic void setFieldSeparatorAtStart(boolean fieldSeparatorAtStart)
ToStringStyleSets whether the field separator should be added at the start of each buffer.
setFieldSeparatorAtStart in class ToStringStylefieldSeparatorAtStart - the fieldSeparatorAtStart flagpublic boolean isFieldSeparatorAtEnd()
ToStringStyleGets whether the field separator should be added at the end of each buffer.
isFieldSeparatorAtEnd in class ToStringStylepublic void setFieldSeparatorAtEnd(boolean fieldSeparatorAtEnd)
ToStringStyleSets whether the field separator should be added at the end of each buffer.
setFieldSeparatorAtEnd in class ToStringStylefieldSeparatorAtEnd - the fieldSeparatorAtEnd flagpublic String getNullText()
ToStringStyleGets the text to output when null found.
getNullText in class ToStringStylepublic void setNullText(String nullText)
ToStringStyleSets the text to output when null found.
null is accepted, but will be converted to
an empty String.
setNullText in class ToStringStylenullText - the new text to output when null foundpublic String getSizeStartText()
ToStringStyleGets the start text to output when a Collection,
Map or array size is output.
This is output before the size value.
getSizeStartText in class ToStringStylepublic void setSizeStartText(String sizeStartText)
ToStringStyleSets 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.
setSizeStartText in class ToStringStylesizeStartText - the new start of size textpublic String getSizeEndText()
ToStringStyleGets the end text to output when a Collection,
Map or array size is output.
This is output after the size value.
getSizeEndText in class ToStringStylepublic void setSizeEndText(String sizeEndText)
ToStringStyleSets 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.
setSizeEndText in class ToStringStylesizeEndText - the new end of size textpublic String getSummaryObjectStartText()
ToStringStyleGets the start text to output when an Object is
output in summary mode.
This is output before the size value.
getSummaryObjectStartText in class ToStringStylepublic void setSummaryObjectStartText(String summaryObjectStartText)
ToStringStyleSets 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.
setSummaryObjectStartText in class ToStringStylesummaryObjectStartText - the new start of summary textpublic String getSummaryObjectEndText()
ToStringStyleGets the end text to output when an Object is
output in summary mode.
This is output after the size value.
getSummaryObjectEndText in class ToStringStylepublic void setSummaryObjectEndText(String summaryObjectEndText)
ToStringStyleSets 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.
setSummaryObjectEndText in class ToStringStylesummaryObjectEndText - the new end of summary textCopyright © 2019. All rights reserved.