Class ToStringBuilder

java.lang.Object
com.github.mjeanroy.dbunit.commons.lang.ToStringBuilder

public final class ToStringBuilder extends Object
Utility class to implement easily toString methods.

This class is part of internal API and should not be used publicly as it may changed at anytime.

  • Method Details

    • create

      public static ToStringBuilder create(Class<?> klass)
      Create the builder with given class (the simple name will be used to start the toString value).
      Parameters:
      klass - The class.
      Returns:
      The builder.
    • create

      public static ToStringBuilder create(Object instance)
      Create the builder with given class of instance (the simple name will be used to start the toString value).
      Parameters:
      instance - The instance.
      Returns:
      The builder.
    • append

      public ToStringBuilder append(String name, String value)
      Append new string field.
      Parameters:
      name - Field name.
      value - Field value.
      Returns:
      The builder.
    • append

      public ToStringBuilder append(String name, char value)
      Append new char field.
      Parameters:
      name - Field name.
      value - Field value.
      Returns:
      The builder.
    • append

      public ToStringBuilder append(String name, Object object)
      Append new object field.
      Parameters:
      name - Field name.
      object - Field value.
      Returns:
      The builder.
    • build

      public String build()
      Create the final string.
      Returns:
      The final string.