Top Description Fields Constructors Methods
org.springframework.core.style

public Class DefaultToStringStyler

extends Object
implements ToStringStyler
Class Inheritance
All Implemented Interfaces
org.springframework.core.style.ToStringStyler
Imports
org.springframework.lang.Nullable, org.springframework.util.Assert, .ClassUtils, .ObjectUtils

Spring's default toString() styler.

This class is used by ToStringCreator to style toString() output in a consistent manner according to Spring conventions.

Authors
Keith Donald, Juergen Hoeller
Since
1.2.2

Field Summary

Modifier and TypeField and Description
private final ValueStyler

Constructor Summary

AccessConstructor and Description
public
DefaultToStringStyler(ValueStyler
the ValueStyler to use
valueStyler
)

Create a new DefaultToStringStyler.

Method Summary

Modifier and TypeMethod and Description
protected final ValueStyler
getValueStyler()

Return the ValueStyler used by this ToStringStyler.

public void
styleEnd(StringBuilder
the buffer to print to
buffer
,
Object
the object to style
o
)

Implements org.springframework.core.style.ToStringStyler.styleEnd.

Style a toString()'ed object after it's fields are styled.
public void
styleField(StringBuilder
the buffer to print to
buffer
,
String
the name of the field
fieldName
,
Object
the field value
value
)

Implements org.springframework.core.style.ToStringStyler.styleField.

Style a field value as a string.
protected void
styleFieldEnd(StringBuilder buffer, String fieldName)

public void
styleFieldSeparator(StringBuilder
the buffer to print to
buffer
)

Implements org.springframework.core.style.ToStringStyler.styleFieldSeparator.

Style the field separator.
protected void
private void
public void
styleStart(StringBuilder
the buffer to print to
buffer
,
Object
the object to style
obj
)

Implements org.springframework.core.style.ToStringStyler.styleStart.

Style a toString()'ed object before its fields are styled.
public void
styleValue(StringBuilder
the buffer to print to
buffer
,
Object
the field value
value
)

Implements org.springframework.core.style.ToStringStyler.styleValue.

Style the given value.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

valueStylerback to summary
private final ValueStyler valueStyler

Constructor Detail

DefaultToStringStylerback to summary
public DefaultToStringStyler(ValueStyler valueStyler)

Create a new DefaultToStringStyler.

Parameters
valueStyler:ValueStyler

the ValueStyler to use

Method Detail

getValueStylerback to summary
protected final ValueStyler getValueStyler()

Return the ValueStyler used by this ToStringStyler.

styleEndback to summary
public void styleEnd(StringBuilder buffer, Object o)

Implements org.springframework.core.style.ToStringStyler.styleEnd.

Doc from org.springframework.core.style.ToStringStyler.styleEnd.

Style a toString()'ed object after it's fields are styled.

Parameters
buffer:StringBuilder

the buffer to print to

o:Object

the object to style

Annotations
@Override
styleFieldback to summary
public void styleField(StringBuilder buffer, String fieldName, Object value)

Implements org.springframework.core.style.ToStringStyler.styleField.

Doc from org.springframework.core.style.ToStringStyler.styleField.

Style a field value as a string.

Parameters
buffer:StringBuilder

the buffer to print to

fieldName:String

the name of the field

value:Object

the field value

Annotations
@Override
styleFieldEndback to summary
protected void styleFieldEnd(StringBuilder buffer, String fieldName)
styleFieldSeparatorback to summary
public void styleFieldSeparator(StringBuilder buffer)

Implements org.springframework.core.style.ToStringStyler.styleFieldSeparator.

Doc from org.springframework.core.style.ToStringStyler.styleFieldSeparator.

Style the field separator.

Parameters
buffer:StringBuilder

the buffer to print to

Annotations
@Override
styleFieldStartback to summary
protected void styleFieldStart(StringBuilder buffer, String fieldName)
styleIdentityHashCodeback to summary
private void styleIdentityHashCode(StringBuilder buffer, Object obj)
styleStartback to summary
public void styleStart(StringBuilder buffer, Object obj)

Implements org.springframework.core.style.ToStringStyler.styleStart.

Doc from org.springframework.core.style.ToStringStyler.styleStart.

Style a toString()'ed object before its fields are styled.

Parameters
buffer:StringBuilder

the buffer to print to

obj:Object

the object to style

Annotations
@Override
styleValueback to summary
public void styleValue(StringBuilder buffer, Object value)

Implements org.springframework.core.style.ToStringStyler.styleValue.

Doc from org.springframework.core.style.ToStringStyler.styleValue.

Style the given value.

Parameters
buffer:StringBuilder

the buffer to print to

value:Object

the field value

Annotations
@Override