Package org.springframework.core.style
Class ToStringCreator
java.lang.Object
org.springframework.core.style.ToStringCreator
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
ConstructorDescriptionToStringCreator
(Object obj) Create a ToStringCreator for the given object.ToStringCreator
(Object obj, ToStringStyler styler) Create a ToStringCreator for the given object, using the provided style.ToStringCreator
(Object obj, ValueStyler styler) Create a ToStringCreator for the given object, using the provided style. -
Method Summary
Modifier and TypeMethodDescriptionAppend the provided value.Append a boolean field value.Append a byte field value.Append a double field value.Append a float field value.Append a integer field value.Append a long field value.Append a short field value.Append a field value.toString()
Return the String representation that this ToStringCreator built.
-
Constructor Details
-
ToStringCreator
Create a ToStringCreator for the given object.- Parameters:
obj
- the object to be stringified
-
ToStringCreator
Create a ToStringCreator for the given object, using the provided style.- Parameters:
obj
- the object to be stringifiedstyler
- the ValueStyler encapsulating pretty-print instructions
-
ToStringCreator
Create a ToStringCreator for the given object, using the provided style.- Parameters:
obj
- the object to be stringifiedstyler
- the ToStringStyler encapsulating pretty-print instructions
-
-
Method Details
-
append
Append a byte field value.- Parameters:
fieldName
- the name of the field, usually the member variable namevalue
- the field value- Returns:
- this, to support call-chaining
-
append
Append a short field value.- Parameters:
fieldName
- the name of the field, usually the member variable namevalue
- the field value- Returns:
- this, to support call-chaining
-
append
Append a integer field value.- Parameters:
fieldName
- the name of the field, usually the member variable namevalue
- the field value- Returns:
- this, to support call-chaining
-
append
Append a long field value.- Parameters:
fieldName
- the name of the field, usually the member variable namevalue
- the field value- Returns:
- this, to support call-chaining
-
append
Append a float field value.- Parameters:
fieldName
- the name of the field, usually the member variable namevalue
- the field value- Returns:
- this, to support call-chaining
-
append
Append a double field value.- Parameters:
fieldName
- the name of the field, usually the member variable namevalue
- the field value- Returns:
- this, to support call-chaining
-
append
Append a boolean field value.- Parameters:
fieldName
- the name of the field, usually the member variable namevalue
- the field value- Returns:
- this, to support call-chaining
-
append
Append a field value.- Parameters:
fieldName
- the name of the field, usually the member variable namevalue
- the field value- Returns:
- this, to support call-chaining
-
append
Append the provided value.- Parameters:
value
- the value to append- Returns:
- this, to support call-chaining.
-
toString
Return the String representation that this ToStringCreator built.
-