Spring Framework

org.springframework.core.style
Class ToStringCreator

java.lang.Object
  extended by org.springframework.core.style.ToStringCreator

public class ToStringCreator
extends java.lang.Object

Utility class that builds pretty-printing toString() methods with pluggable styling conventions. By default, ToStringCreator adheres to Spring's toString() styling conventions.

Since:
1.2.2
Author:
Keith Donald, Juergen Hoeller

Constructor Summary
ToStringCreator(java.lang.Object obj)
          Create a ToStringCreator for the given object.
ToStringCreator(java.lang.Object obj, ToStringStyler styler)
          Create a ToStringCreator for the given object, using the provided style.
ToStringCreator(java.lang.Object obj, ValueStyler styler)
          Create a ToStringCreator for the given object, using the provided style.
 
Method Summary
 ToStringCreator append(java.lang.Object value)
          Append the provided value.
 ToStringCreator append(java.lang.String fieldName, boolean value)
          Append a boolean field value.
 ToStringCreator append(java.lang.String fieldName, byte value)
          Append a byte field value.
 ToStringCreator append(java.lang.String fieldName, double value)
          Append a double field value.
 ToStringCreator append(java.lang.String fieldName, float value)
          Append a float field value.
 ToStringCreator append(java.lang.String fieldName, int value)
          Append a integer field value.
 ToStringCreator append(java.lang.String fieldName, long value)
          Append a long field value.
 ToStringCreator append(java.lang.String fieldName, java.lang.Object value)
          Append a field value.
 ToStringCreator append(java.lang.String fieldName, short value)
          Append a short field value.
 java.lang.String toString()
          Return the String representation that this ToStringCreator built.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ToStringCreator

public ToStringCreator(java.lang.Object obj)
Create a ToStringCreator for the given object.

Parameters:
obj - the object to be stringified

ToStringCreator

public ToStringCreator(java.lang.Object obj,
                       ValueStyler styler)
Create a ToStringCreator for the given object, using the provided style.

Parameters:
obj - the object to be stringified
styler - the ValueStyler encapsulating pretty-print instructions

ToStringCreator

public ToStringCreator(java.lang.Object obj,
                       ToStringStyler styler)
Create a ToStringCreator for the given object, using the provided style.

Parameters:
obj - the object to be stringified
styler - the ToStringStyler encapsulating pretty-print instructions
Method Detail

append

public ToStringCreator append(java.lang.String fieldName,
                              byte value)
Append a byte field value.

Parameters:
fieldName - the name of the field, usually the member variable name
value - the field value
Returns:
this, to support call-chaining

append

public ToStringCreator append(java.lang.String fieldName,
                              short value)
Append a short field value.

Parameters:
fieldName - the name of the field, usually the member variable name
value - the field value
Returns:
this, to support call-chaining

append

public ToStringCreator append(java.lang.String fieldName,
                              int value)
Append a integer field value.

Parameters:
fieldName - the name of the field, usually the member variable name
value - the field value
Returns:
this, to support call-chaining

append

public ToStringCreator append(java.lang.String fieldName,
                              long value)
Append a long field value.

Parameters:
fieldName - the name of the field, usually the member variable name
value - the field value
Returns:
this, to support call-chaining

append

public ToStringCreator append(java.lang.String fieldName,
                              float value)
Append a float field value.

Parameters:
fieldName - the name of the field, usually the member variable name
value - the field value
Returns:
this, to support call-chaining

append

public ToStringCreator append(java.lang.String fieldName,
                              double value)
Append a double field value.

Parameters:
fieldName - the name of the field, usually the member variable name
value - the field value
Returns:
this, to support call-chaining

append

public ToStringCreator append(java.lang.String fieldName,
                              boolean value)
Append a boolean field value.

Parameters:
fieldName - the name of the field, usually the member variable name
value - the field value
Returns:
this, to support call-chaining

append

public ToStringCreator append(java.lang.String fieldName,
                              java.lang.Object value)
Append a field value.

Parameters:
fieldName - the name of the field, usually the member variable name
value - the field value
Returns:
this, to support call-chaining

append

public ToStringCreator append(java.lang.Object value)
Append the provided value.

Parameters:
value - The value to append
Returns:
this, to support call-chaining.

toString

public java.lang.String toString()
Return the String representation that this ToStringCreator built.

Overrides:
toString in class java.lang.Object

Spring Framework