类 ToStringCreator
- java.lang.Object
- org.springframework.core.style.ToStringCreator
public class ToStringCreator extends Object
Utility class that builds pretty-printingtoString()
methods with pluggable styling conventions. By default, ToStringCreator adheres to Spring'stoString()
styling conventions.- 从以下版本开始:
- 1.2.2
- 作者:
- Keith Donald, Juergen Hoeller
构造器概要
构造器 构造器 说明 ToStringCreator(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.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 ToStringCreator
append(Object value)
Append the provided value.ToStringCreator
append(String fieldName, boolean value)
Append a boolean field value.ToStringCreator
append(String fieldName, byte value)
Append a byte field value.ToStringCreator
append(String fieldName, double value)
Append a double field value.ToStringCreator
append(String fieldName, float value)
Append a float field value.ToStringCreator
append(String fieldName, int value)
Append a integer field value.ToStringCreator
append(String fieldName, long value)
Append a long field value.ToStringCreator
append(String fieldName, short value)
Append a short field value.ToStringCreator
append(String fieldName, Object value)
Append a field value.String
toString()
Return the String representation that this ToStringCreator built.
构造器详细资料
ToStringCreator
public ToStringCreator(Object obj)
Create a ToStringCreator for the given object.- 参数:
obj
- the object to be stringified
ToStringCreator
public ToStringCreator(Object obj, @Nullable ValueStyler styler)
Create a ToStringCreator for the given object, using the provided style.- 参数:
obj
- the object to be stringifiedstyler
- the ValueStyler encapsulating pretty-print instructions
ToStringCreator
public ToStringCreator(Object obj, @Nullable ToStringStyler styler)
Create a ToStringCreator for the given object, using the provided style.- 参数:
obj
- the object to be stringifiedstyler
- the ToStringStyler encapsulating pretty-print instructions
方法详细资料
append
public ToStringCreator append(String fieldName, byte value)
Append a byte field value.- 参数:
fieldName
- the name of the field, usually the member variable namevalue
- the field value- 返回:
- this, to support call-chaining
append
public ToStringCreator append(String fieldName, short value)
Append a short field value.- 参数:
fieldName
- the name of the field, usually the member variable namevalue
- the field value- 返回:
- this, to support call-chaining
append
public ToStringCreator append(String fieldName, int value)
Append a integer field value.- 参数:
fieldName
- the name of the field, usually the member variable namevalue
- the field value- 返回:
- this, to support call-chaining
append
public ToStringCreator append(String fieldName, long value)
Append a long field value.- 参数:
fieldName
- the name of the field, usually the member variable namevalue
- the field value- 返回:
- this, to support call-chaining
append
public ToStringCreator append(String fieldName, float value)
Append a float field value.- 参数:
fieldName
- the name of the field, usually the member variable namevalue
- the field value- 返回:
- this, to support call-chaining
append
public ToStringCreator append(String fieldName, double value)
Append a double field value.- 参数:
fieldName
- the name of the field, usually the member variable namevalue
- the field value- 返回:
- this, to support call-chaining
append
public ToStringCreator append(String fieldName, boolean value)
Append a boolean field value.- 参数:
fieldName
- the name of the field, usually the member variable namevalue
- the field value- 返回:
- this, to support call-chaining
append
public ToStringCreator append(String fieldName, @Nullable Object value)
Append a field value.- 参数:
fieldName
- the name of the field, usually the member variable namevalue
- the field value- 返回:
- this, to support call-chaining
append
public ToStringCreator append(Object value)
Append the provided value.- 参数:
value
- the value to append- 返回:
- this, to support call-chaining.