类 ToStringBuilder

java.lang.Object
cn.taketoday.core.style.ToStringBuilder

public class ToStringBuilder extends Object
Utility class that builds pretty-printing toString() methods with pluggable styling conventions.
从以下版本开始:
4.0
作者:
Keith Donald, Juergen Hoeller
  • 构造器详细资料

    • ToStringBuilder

      public ToStringBuilder(Object obj)
      Create a ToStringBuilder for the given object.
      参数:
      obj - the object to be stringified
    • ToStringBuilder

      public ToStringBuilder(Object obj, @Nullable ValueStyler styler)
      Create a ToStringBuilder for the given object, using the provided style.
      参数:
      obj - the object to be stringified
      styler - the ValueStyler encapsulating pretty-print instructions
    • ToStringBuilder

      public ToStringBuilder(Object obj, @Nullable ToStringStyler styler)
      Create a ToStringBuilder for the given object, using the provided style.
      参数:
      obj - the object to be stringified
      styler - the ToStringStyler encapsulating pretty-print instructions
  • 方法详细资料

    • append

      public ToStringBuilder append(String fieldName, byte value)
      Append a byte field value.
      参数:
      fieldName - the name of the field, usually the member variable name
      value - the field value
      返回:
      this, to support call-chaining
    • append

      public ToStringBuilder append(String fieldName, short value)
      Append a short field value.
      参数:
      fieldName - the name of the field, usually the member variable name
      value - the field value
      返回:
      this, to support call-chaining
    • append

      public ToStringBuilder append(String fieldName, int value)
      Append a integer field value.
      参数:
      fieldName - the name of the field, usually the member variable name
      value - the field value
      返回:
      this, to support call-chaining
    • append

      public ToStringBuilder append(String fieldName, long value)
      Append a long field value.
      参数:
      fieldName - the name of the field, usually the member variable name
      value - the field value
      返回:
      this, to support call-chaining
    • append

      public ToStringBuilder append(String fieldName, float value)
      Append a float field value.
      参数:
      fieldName - the name of the field, usually the member variable name
      value - the field value
      返回:
      this, to support call-chaining
    • append

      public ToStringBuilder append(String fieldName, double value)
      Append a double field value.
      参数:
      fieldName - the name of the field, usually the member variable name
      value - the field value
      返回:
      this, to support call-chaining
    • append

      public ToStringBuilder append(String fieldName, boolean value)
      Append a boolean field value.
      参数:
      fieldName - the name of the field, usually the member variable name
      value - the field value
      返回:
      this, to support call-chaining
    • append

      public ToStringBuilder append(String fieldName, @Nullable Object value)
      Append a field value.
      参数:
      fieldName - the name of the field, usually the member variable name
      value - the field value
      返回:
      this, to support call-chaining
    • append

      public ToStringBuilder append(Object value)
      Append the provided value.
      参数:
      value - the value to append
      返回:
      this, to support call-chaining.
    • toString

      public String toString()
      Return the String representation that this ToStringBuilder built.
      覆盖:
      toString 在类中 Object
    • from

      public static ToStringBuilder from(Object obj)