Class MoreObjects.ToStringHelper

java.lang.Object
org.glassfish.jersey.internal.guava.MoreObjects.ToStringHelper
Enclosing class:
MoreObjects

public static final class MoreObjects.ToStringHelper extends Object
Since:
18.0 (since 2.0 as Objects.ToStringHelper.
Author:
Jason Lee
  • Method Details

    • add

      public MoreObjects.ToStringHelper add(String name, Object value)
      Adds a name/value pair to the formatted output in name=value format. If value is null, the string "null" is used, unless #omitNullValues() is called, in which case this name/value pair will not be added.
    • add

      public MoreObjects.ToStringHelper add(String name, int value)
      Adds a name/value pair to the formatted output in name=value format.
      Since:
      18.0 (since 11.0 as Objects.ToStringHelper.omitNullValues().
    • add

      public MoreObjects.ToStringHelper add(String name, long value)
      Adds a name/value pair to the formatted output in name=value format.
      Since:
      18.0 (since 11.0 as Objects.ToStringHelper.omitNullValues().
    • toString

      public String toString()
      Returns a string in the format specified by MoreObjects.toStringHelper(Object).

      After calling this method, you can keep adding more properties to later call toString() again and get a more complete representation of the same object; but properties cannot be removed, so this only allows limited reuse of the helper instance. The helper allows duplication of properties (multiple name/value pairs with the same name can be added).

      Overrides:
      toString in class Object