public static final class MoreObjects.ToStringHelper
extends java.lang.Object
MoreObjects.toStringHelper(java.lang.Object).Objects.ToStringHelper).| Modifier and Type | Method and Description |
|---|---|
MoreObjects.ToStringHelper |
add(java.lang.String name,
int value)
Adds a name/value pair to the formatted output in
name=value
format. |
MoreObjects.ToStringHelper |
add(java.lang.String name,
long value)
Adds a name/value pair to the formatted output in
name=value
format. |
MoreObjects.ToStringHelper |
add(java.lang.String name,
java.lang.Object value)
Adds a name/value pair to the formatted output in
name=value
format. |
MoreObjects.ToStringHelper |
addValue(java.lang.Object value)
Adds an unnamed value to the formatted output.
|
java.lang.String |
toString()
Returns a string in the format specified by
MoreObjects.toStringHelper(Object). |
@Nonnull public MoreObjects.ToStringHelper add(@Nonnull java.lang.String name, java.lang.Object value)
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.@Nonnull public MoreObjects.ToStringHelper add(@Nonnull java.lang.String name, int value)
name=value
format.Objects.ToStringHelper.add()).@Nonnull public MoreObjects.ToStringHelper add(@Nonnull java.lang.String name, long value)
name=value
format.Objects.ToStringHelper.add()).@Nonnull public MoreObjects.ToStringHelper addValue(java.lang.Object value)
It is strongly encouraged to use add(String, Object) instead
and give value a readable name.
public java.lang.String toString()
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).
toString in class java.lang.Object