public class DefaultToStringStyler extends java.lang.Object implements ToStringStyler
toString()
styler.
This class is used by ToStringCreator
to style toString()
output in a consistent manner according to Spring conventions.
Modifier and Type | Field and Description |
---|---|
private ValueStyler |
valueStyler |
Constructor and Description |
---|
DefaultToStringStyler(ValueStyler valueStyler)
Create a new DefaultToStringStyler.
|
Modifier and Type | Method and Description |
---|---|
protected ValueStyler |
getValueStyler()
Return the ValueStyler used by this ToStringStyler.
|
void |
styleEnd(java.lang.StringBuilder buffer,
java.lang.Object o)
Style a
toString() 'ed object after it's fields are styled. |
void |
styleField(java.lang.StringBuilder buffer,
java.lang.String fieldName,
java.lang.Object value)
Style a field value as a string.
|
protected void |
styleFieldEnd(java.lang.StringBuilder buffer,
java.lang.String fieldName) |
void |
styleFieldSeparator(java.lang.StringBuilder buffer)
Style the field separator.
|
protected void |
styleFieldStart(java.lang.StringBuilder buffer,
java.lang.String fieldName) |
private void |
styleIdentityHashCode(java.lang.StringBuilder buffer,
java.lang.Object obj) |
void |
styleStart(java.lang.StringBuilder buffer,
java.lang.Object obj)
Style a
toString() 'ed object before its fields are styled. |
void |
styleValue(java.lang.StringBuilder buffer,
java.lang.Object value)
Style the given value.
|
private final ValueStyler valueStyler
public DefaultToStringStyler(ValueStyler valueStyler)
valueStyler
- the ValueStyler to useprotected final ValueStyler getValueStyler()
public void styleStart(java.lang.StringBuilder buffer, java.lang.Object obj)
ToStringStyler
toString()
'ed object before its fields are styled.styleStart
in interface ToStringStyler
buffer
- the buffer to print toobj
- the object to styleprivate void styleIdentityHashCode(java.lang.StringBuilder buffer, java.lang.Object obj)
public void styleEnd(java.lang.StringBuilder buffer, java.lang.Object o)
ToStringStyler
toString()
'ed object after it's fields are styled.styleEnd
in interface ToStringStyler
buffer
- the buffer to print too
- the object to stylepublic void styleField(java.lang.StringBuilder buffer, java.lang.String fieldName, java.lang.Object value)
ToStringStyler
styleField
in interface ToStringStyler
buffer
- the buffer to print tofieldName
- the he name of the fieldvalue
- the field valueprotected void styleFieldStart(java.lang.StringBuilder buffer, java.lang.String fieldName)
protected void styleFieldEnd(java.lang.StringBuilder buffer, java.lang.String fieldName)
public void styleValue(java.lang.StringBuilder buffer, java.lang.Object value)
ToStringStyler
styleValue
in interface ToStringStyler
buffer
- the buffer to print tovalue
- the field valuepublic void styleFieldSeparator(java.lang.StringBuilder buffer)
ToStringStyler
styleFieldSeparator
in interface ToStringStyler
buffer
- buffer to print to