Package org.springframework.core.style
Class DefaultToStringStyler
- java.lang.Object
- org.springframework.core.style.DefaultToStringStyler
- All Implemented Interfaces:
ToStringStyler
public class DefaultToStringStyler extends Object implements ToStringStyler
Spring's defaulttoString()styler.This class is used by
ToStringCreatorto styletoString()output in a consistent manner according to Spring conventions.- Since:
- 1.2.2
- Author:
- Keith Donald, Juergen Hoeller
Constructor Summary
Constructors Constructor Description DefaultToStringStyler(ValueStyler valueStyler)Create a new DefaultToStringStyler.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ValueStylergetValueStyler()Return the ValueStyler used by this ToStringStyler.voidstyleEnd(StringBuilder buffer, Object o)Style atoString()'ed object after it's fields are styled.voidstyleField(StringBuilder buffer, String fieldName, Object value)Style a field value as a string.protected voidstyleFieldEnd(StringBuilder buffer, String fieldName)voidstyleFieldSeparator(StringBuilder buffer)Style the field separator.protected voidstyleFieldStart(StringBuilder buffer, String fieldName)voidstyleStart(StringBuilder buffer, Object obj)Style atoString()'ed object before its fields are styled.voidstyleValue(StringBuilder buffer, Object value)Style the given value.
Constructor Detail
DefaultToStringStyler
public DefaultToStringStyler(ValueStyler valueStyler)
Create a new DefaultToStringStyler.- Parameters:
valueStyler- the ValueStyler to use
Method Detail
getValueStyler
protected final ValueStyler getValueStyler()
Return the ValueStyler used by this ToStringStyler.
styleStart
public void styleStart(StringBuilder buffer, Object obj)
Description copied from interface:ToStringStylerStyle atoString()'ed object before its fields are styled.- Specified by:
styleStartin interfaceToStringStyler- Parameters:
buffer- the buffer to print toobj- the object to style
styleEnd
public void styleEnd(StringBuilder buffer, Object o)
Description copied from interface:ToStringStylerStyle atoString()'ed object after it's fields are styled.- Specified by:
styleEndin interfaceToStringStyler- Parameters:
buffer- the buffer to print too- the object to style
styleField
public void styleField(StringBuilder buffer, String fieldName, Object value)
Description copied from interface:ToStringStylerStyle a field value as a string.- Specified by:
styleFieldin interfaceToStringStyler- Parameters:
buffer- the buffer to print tofieldName- the he name of the fieldvalue- the field value
styleFieldStart
protected void styleFieldStart(StringBuilder buffer, String fieldName)
styleFieldEnd
protected void styleFieldEnd(StringBuilder buffer, String fieldName)
styleValue
public void styleValue(StringBuilder buffer, Object value)
Description copied from interface:ToStringStylerStyle the given value.- Specified by:
styleValuein interfaceToStringStyler- Parameters:
buffer- the buffer to print tovalue- the field value
styleFieldSeparator
public void styleFieldSeparator(StringBuilder buffer)
Description copied from interface:ToStringStylerStyle the field separator.- Specified by:
styleFieldSeparatorin interfaceToStringStyler- Parameters:
buffer- buffer to print to