On this page

StandardToStringStyle

public class org.apache.commons.lang3.builder.StandardToStringStyle extends ToStringStyle[source]

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.

Since:

1.0

Constructors

StandardToStringStyle()

Constructs a new instance.

public StandardToStringStyle()[source]

Constructs a new instance.

Methods

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 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()

Tests whether to output array content detail.

boolean

isDefaultFullDetail()

Tests whether full detail is used when the caller does not specify a detail level.

boolean

isFieldSeparatorAtEnd()

Tests whether the field separator should be added at the end of each buffer.

boolean

isFieldSeparatorAtStart()

Tests whether the field separator should be added at the start of each buffer.

boolean

isUseClassName()

Tests whether to use the class name.

boolean

isUseFieldNames()

Tests whether to use the field names passed in.

boolean

isUseIdentityHashCode()

Tests whether to use the identity hash code.

boolean

isUseShortClassName()

Tests whether short class names should be output.

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.

public String getArrayEnd()[source]

Gets the array end text.

Overrides:

getArrayEnd in class ToStringStyle

Returns:

The current array end text

public String getArraySeparator()[source]

Gets the array separator text.

Overrides:

getArraySeparator in class ToStringStyle

Returns:

The current array separator text

public String getArrayStart()[source]

Gets the array start text.

Overrides:

getArrayStart in class ToStringStyle

Returns:

The current array start text

public String getContentEnd()[source]

Gets the content end text.

Overrides:

getContentEnd in class ToStringStyle

Returns:

The current content end text

public String getContentStart()[source]

Gets the content start text.

Overrides:

getContentStart in class ToStringStyle

Returns:

The current content start text

public String getFieldNameValueSeparator()[source]

Gets the field name value separator text.

Overrides:

getFieldNameValueSeparator in class ToStringStyle

Returns:

The current field name value separator text

public String getFieldSeparator()[source]

Gets the field separator text.

Overrides:

getFieldSeparator in class ToStringStyle

Returns:

The current field separator text

public String getNullText()[source]

Gets the text to output when null found.

Overrides:

getNullText in class ToStringStyle

Returns:

The current text to output when null found

public String getSizeEndText()[source]

Gets the end text to output when a Collection, Map or Array size is output.

This is output after the size value.

Overrides:

getSizeEndText in class ToStringStyle

Returns:

The current end of size text

public String getSizeStartText()[source]

Gets the text to output when a Collection, Map or Array size is output.

This is output before the size value.

Overrides:

getSizeStartText in class ToStringStyle

Returns:

The current start of size text

public String getSummaryObjectEndText()[source]

Gets the end text to output when an Object is output in summary mode.

This is output after the size value.

Overrides:

getSummaryObjectEndText in class ToStringStyle

Returns:

The current end of summary text

public String getSummaryObjectStartText()[source]

Gets the start text to output when an Object is output in summary mode.

This is output before the size value.

Overrides:

getSummaryObjectStartText in class ToStringStyle

Returns:

The current start of summary text

public boolean isArrayContentDetail()[source]

Tests whether to output array content detail.

Overrides:

isArrayContentDetail in class ToStringStyle

Returns:

The current array content detail setting

public boolean isDefaultFullDetail()[source]

Tests whether full detail is used when the caller does not specify a detail level.

Overrides:

isDefaultFullDetail in class ToStringStyle

Returns:

The current defaultFullDetail flag

public boolean isFieldSeparatorAtEnd()[source]

Tests whether the field separator should be added at the end of each buffer.

Overrides:

isFieldSeparatorAtEnd in class ToStringStyle

Returns:

fieldSeparatorAtEnd flag

Since:

2.0

public boolean isFieldSeparatorAtStart()[source]

Tests whether the field separator should be added at the start of each buffer.

Overrides:

isFieldSeparatorAtStart in class ToStringStyle

Returns:

The fieldSeparatorAtStart flag

Since:

2.0

public boolean isUseClassName()[source]

Tests whether to use the class name.

Overrides:

isUseClassName in class ToStringStyle

Returns:

The current useClassName flag

public boolean isUseFieldNames()[source]

Tests whether to use the field names passed in.

Overrides:

isUseFieldNames in class ToStringStyle

Returns:

The current useFieldNames flag

public boolean isUseIdentityHashCode()[source]

Tests whether to use the identity hash code.

Overrides:

isUseIdentityHashCode in class ToStringStyle

Returns:

The current useIdentityHashCode flag

public boolean isUseShortClassName()[source]

Tests whether short class names should be output.

Overrides:

isUseShortClassName in class ToStringStyle

Returns:

The current useShortClassName flag

Since:

2.0

public void setArrayContentDetail(boolean arrayContentDetail)[source]

Sets whether to output array content detail.

Overrides:

setArrayContentDetail in class ToStringStyle

Parameters:

arrayContentDetail – The new arrayContentDetail flag

public void setArrayEnd(String arrayEnd)[source]

Sets the array end text.

null is accepted, but will be converted to an empty String.

Overrides:

setArrayEnd in class ToStringStyle

Parameters:

arrayEnd – The new array end text

public void setArraySeparator(String arraySeparator)[source]

Sets the array separator text.

null is accepted, but will be converted to an empty String.

Overrides:

setArraySeparator in class ToStringStyle

Parameters:

arraySeparator – The new array separator text

public void setArrayStart(String arrayStart)[source]

Sets the array start text.

null is accepted, but will be converted to an empty String.

Overrides:

setArrayStart in class ToStringStyle

Parameters:

arrayStart – The new array start text

public void setContentEnd(String contentEnd)[source]

Sets the content end text.

null is accepted, but will be converted to an empty String.

Overrides:

setContentEnd in class ToStringStyle

Parameters:

contentEnd – The new content end text

public void setContentStart(String contentStart)[source]

Sets the content start text.

null is accepted, but will be converted to an empty String.

Overrides:

setContentStart in class ToStringStyle

Parameters:

contentStart – The new content start text

public void setDefaultFullDetail(boolean defaultFullDetail)[source]

Sets whether to use full detail when the caller doesn't specify.

Overrides:

setDefaultFullDetail in class ToStringStyle

Parameters:

defaultFullDetail – The new defaultFullDetail flag

public void setFieldNameValueSeparator(String fieldNameValueSeparator)[source]

Sets the field name value separator text.

null is accepted, but will be converted to an empty String.

Overrides:

setFieldNameValueSeparator in class ToStringStyle

Parameters:

fieldNameValueSeparator – The new field name value separator text

public void setFieldSeparator(String fieldSeparator)[source]

Sets the field separator text.

null is accepted, but will be converted to an empty String.

Overrides:

setFieldSeparator in class ToStringStyle

Parameters:

fieldSeparator – The new field separator text

public void setFieldSeparatorAtEnd(boolean fieldSeparatorAtEnd)[source]

Sets whether the field separator should be added at the end of each buffer.

Overrides:

setFieldSeparatorAtEnd in class ToStringStyle

Parameters:

fieldSeparatorAtEnd – The fieldSeparatorAtEnd flag

Since:

2.0

public void setFieldSeparatorAtStart(boolean fieldSeparatorAtStart)[source]

Sets whether the field separator should be added at the start of each buffer.

Overrides:

setFieldSeparatorAtStart in class ToStringStyle

Parameters:

fieldSeparatorAtStart – The fieldSeparatorAtStart flag

Since:

2.0

public void setNullText(String nullText)[source]

Sets the text to output when null found.

null is accepted, but will be converted to an empty String.

Overrides:

setNullText in class ToStringStyle

Parameters:

nullText – The new text to output when null found

public void setSizeEndText(String sizeEndText)[source]

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.

Overrides:

setSizeEndText in class ToStringStyle

Parameters:

sizeEndText – The new end of size text

public void setSizeStartText(String sizeStartText)[source]

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.

Overrides:

setSizeStartText in class ToStringStyle

Parameters:

sizeStartText – The new start of size text

public void setSummaryObjectEndText(String summaryObjectEndText)[source]

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.

Overrides:

setSummaryObjectEndText in class ToStringStyle

Parameters:

summaryObjectEndText – The new end of summary text

public void setSummaryObjectStartText(String summaryObjectStartText)[source]

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.

Overrides:

setSummaryObjectStartText in class ToStringStyle

Parameters:

summaryObjectStartText – The new start of summary text

public void setUseClassName(boolean useClassName)[source]

Sets whether to use the class name.

Overrides:

setUseClassName in class ToStringStyle

Parameters:

useClassName – The new useClassName flag

public void setUseFieldNames(boolean useFieldNames)[source]

Sets whether to use the field names passed in.

Overrides:

setUseFieldNames in class ToStringStyle

Parameters:

useFieldNames – The new useFieldNames flag

public void setUseIdentityHashCode(boolean useIdentityHashCode)[source]

Sets whether to use the identity hash code.

Overrides:

setUseIdentityHashCode in class ToStringStyle

Parameters:

useIdentityHashCode – The new useIdentityHashCode flag

public void setUseShortClassName(boolean useShortClassName)[source]

Sets whether to output short or long class names.

Overrides:

setUseShortClassName in class ToStringStyle

Parameters:

useShortClassName – The new useShortClassName flag

Since:

2.0