## com.google.common.base
Class Objects.ToStringHelper

    java.lang.Object
      com.google.common.base.Objects.ToStringHelper

Enclosing class:
  Objects

    public static final class Objects.ToStringHelper

extends Object

Support class for `Objects.toStringHelper(java.lang.Object)`.

Since:
  2.0
Author:
  Jason Lee

Method Summary
`Objects.ToStringHelper` `add(String name, boolean value)` Adds a name/value pair to the formatted output in `name=value` format.
`Objects.ToStringHelper` `add(String name, char value)` Adds a name/value pair to the formatted output in `name=value` format.
`Objects.ToStringHelper` `add(String name, double value)` Adds a name/value pair to the formatted output in `name=value` format.
`Objects.ToStringHelper` `add(String name, float value)` Adds a name/value pair to the formatted output in `name=value` format.
`Objects.ToStringHelper` `add(String name, int value)` Adds a name/value pair to the formatted output in `name=value` format.
`Objects.ToStringHelper` `add(String name, long value)` Adds a name/value pair to the formatted output in `name=value` format.
`Objects.ToStringHelper` `add(String name, Object value)` Adds a name/value pair to the formatted output in `name=value` format.
`Objects.ToStringHelper` `addValue(boolean value)` Adds an unnamed value to the formatted output.
`Objects.ToStringHelper` `addValue(char value)` Adds an unnamed value to the formatted output.
`Objects.ToStringHelper` `addValue(double value)` Adds an unnamed value to the formatted output.
`Objects.ToStringHelper` `addValue(float value)` Adds an unnamed value to the formatted output.
`Objects.ToStringHelper` `addValue(int value)` Adds an unnamed value to the formatted output.
`Objects.ToStringHelper` `addValue(long value)` Adds an unnamed value to the formatted output.
`Objects.ToStringHelper` `addValue(Object value)` Adds an unnamed value to the formatted output.
`Objects.ToStringHelper` `omitNullValues()` When called, the formatted output returned by `toString()` will ignore `null` values.
`String` `toString()` Returns a string in the format specified by `Objects.toStringHelper(Object)`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Method Detail

### omitNullValues

    @Beta
    public Objects.ToStringHelper omitNullValues()

  When called, the formatted output returned by `toString()` will ignore `null` values.

  Since:
    12.0

### add

    public Objects.ToStringHelper add(String name,
                                      @Nullable
                                      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 Objects.ToStringHelper add(String name,
                                      boolean value)

  Adds a name/value pair to the formatted output in `name=value` format.

  Since:
    11.0 (source-compatible since 2.0)

### add

    public Objects.ToStringHelper add(String name,
                                      char value)

  Adds a name/value pair to the formatted output in `name=value` format.

  Since:
    11.0 (source-compatible since 2.0)

### add

    public Objects.ToStringHelper add(String name,
                                      double value)

  Adds a name/value pair to the formatted output in `name=value` format.

  Since:
    11.0 (source-compatible since 2.0)

### add

    public Objects.ToStringHelper add(String name,
                                      float value)

  Adds a name/value pair to the formatted output in `name=value` format.

  Since:
    11.0 (source-compatible since 2.0)

### add

    public Objects.ToStringHelper add(String name,
                                      int value)

  Adds a name/value pair to the formatted output in `name=value` format.

  Since:
    11.0 (source-compatible since 2.0)

### add

    public Objects.ToStringHelper add(String name,
                                      long value)

  Adds a name/value pair to the formatted output in `name=value` format.

  Since:
    11.0 (source-compatible since 2.0)

### addValue

    public Objects.ToStringHelper addValue(@Nullable
                                           Object value)

  Adds an unnamed value to the formatted output.

  It is strongly encouraged to use `add(String, Object)` instead and give value a readable name.

### addValue

    public Objects.ToStringHelper addValue(boolean value)

  Adds an unnamed value to the formatted output.

  It is strongly encouraged to use `add(String, boolean)` instead and give value a readable name.

  Since:
    11.0 (source-compatible since 2.0)

### addValue

    public Objects.ToStringHelper addValue(char value)

  Adds an unnamed value to the formatted output.

  It is strongly encouraged to use `add(String, char)` instead and give value a readable name.

  Since:
    11.0 (source-compatible since 2.0)

### addValue

    public Objects.ToStringHelper addValue(double value)

  Adds an unnamed value to the formatted output.

  It is strongly encouraged to use `add(String, double)` instead and give value a readable name.

  Since:
    11.0 (source-compatible since 2.0)

### addValue

    public Objects.ToStringHelper addValue(float value)

  Adds an unnamed value to the formatted output.

  It is strongly encouraged to use `add(String, float)` instead and give value a readable name.

  Since:
    11.0 (source-compatible since 2.0)

### addValue

    public Objects.ToStringHelper addValue(int value)

  Adds an unnamed value to the formatted output.

  It is strongly encouraged to use `add(String, int)` instead and give value a readable name.

  Since:
    11.0 (source-compatible since 2.0)

### addValue

    public Objects.ToStringHelper addValue(long value)

  Adds an unnamed value to the formatted output.

  It is strongly encouraged to use `add(String, long)` instead and give value a readable name.

  Since:
    11.0 (source-compatible since 2.0)

### toString

    public String toString()

  Returns a string in the format specified by `Objects.toStringHelper(Object)`.

  Overrides:
    `toString` in class `Object`

Copyright © 2010-2012. All Rights Reserved.