Spring Framework

org.springframework.core.style
Class DefaultToStringStyler

java.lang.Object
  extended by org.springframework.core.style.DefaultToStringStyler
All Implemented Interfaces:
ToStringStyler

public class DefaultToStringStyler
extends java.lang.Object
implements ToStringStyler

Spring's default toString() styler.

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

Since:
1.2.2
Author:
Keith Donald, Juergen Hoeller

Constructor Summary
DefaultToStringStyler(ValueStyler valueStyler)
          Create a new DefaultToStringStyler.
 
Method Summary
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)
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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(java.lang.StringBuilder buffer,
                       java.lang.Object obj)
Description copied from interface: ToStringStyler
Style a toString()'ed object before its fields are styled.

Specified by:
styleStart in interface ToStringStyler
Parameters:
buffer - the buffer to print to
obj - the object to style

styleEnd

public void styleEnd(java.lang.StringBuilder buffer,
                     java.lang.Object o)
Description copied from interface: ToStringStyler
Style a toString()'ed object after it's fields are styled.

Specified by:
styleEnd in interface ToStringStyler
Parameters:
buffer - the buffer to print to
o - the object to style

styleField

public void styleField(java.lang.StringBuilder buffer,
                       java.lang.String fieldName,
                       java.lang.Object value)
Description copied from interface: ToStringStyler
Style a field value as a string.

Specified by:
styleField in interface ToStringStyler
Parameters:
buffer - the buffer to print to
fieldName - the he name of the field
value - the field value

styleFieldStart

protected void styleFieldStart(java.lang.StringBuilder buffer,
                               java.lang.String fieldName)

styleFieldEnd

protected void styleFieldEnd(java.lang.StringBuilder buffer,
                             java.lang.String fieldName)

styleValue

public void styleValue(java.lang.StringBuilder buffer,
                       java.lang.Object value)
Description copied from interface: ToStringStyler
Style the given value.

Specified by:
styleValue in interface ToStringStyler
Parameters:
buffer - the buffer to print to
value - the field value

styleFieldSeparator

public void styleFieldSeparator(java.lang.StringBuilder buffer)
Description copied from interface: ToStringStyler
Style the field separator.

Specified by:
styleFieldSeparator in interface ToStringStyler
Parameters:
buffer - buffer to print to

Spring Framework