Object, and are not already provided in java.util.Objects .
See the Guava User Guide on writing Object
methods with MoreObjects.
Objects)
| Modifier and Type | Class and Description |
|---|---|
| public static class | MoreObjects.
Support class for |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static <T> T | Returns: first if it is non-null; otherwise second if it is non-nullReturns the first of two given parameters that is not |
| public static MoreObjects. | toStringHelper(Object
the object to generate the string for (typically self)this), used only for its
class nameCreates an instance of |
| public static MoreObjects. | toStringHelper(Class<?>
the clazz)Class of the instanceCreates an instance of |
| public static MoreObjects. | toStringHelper(String
the name of the instance type className)Creates an instance of |
| MoreObjects | back to summary |
|---|---|
| private MoreObjects() | |
| firstNonNull | back to summary |
|---|---|
| public static <T> T firstNonNull(T first, T second) Returns the first of two given parameters that is not To find the first non-null element in an iterable, use Note if Java 9 users: use
| |
| toStringHelper | back to summary |
|---|---|
| public static MoreObjects. Creates an instance of This is helpful for implementing
Note that in GWT, class names are often obfuscated.
| |
| toStringHelper | back to summary |
|---|---|
| public static MoreObjects. Creates an instance of Note that in GWT, class names are often obfuscated. | |
| toStringHelper | back to summary |
|---|---|
| public static MoreObjects. Creates an instance of
| |
MoreObjects#toStringHelper.
Objects.ToStringHelper).
| Modifier and Type | Class and Description |
|---|---|
| private static class | MoreObjects.
Holder object for values that cannot be null or empty (will be printed unconditionally). |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| private final MoreObjects. | |
| private MoreObjects. | |
| private boolean | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public MoreObjects. | |
| public MoreObjects. | |
| public MoreObjects. | |
| public MoreObjects. | |
| public MoreObjects. | |
| public MoreObjects. | |
| public MoreObjects. | |
| private MoreObjects. | |
| private MoreObjects. | |
| private MoreObjects. | |
| private MoreObjects. | |
| private MoreObjects. | |
| private MoreObjects. | |
| public MoreObjects. | |
| public MoreObjects. | |
| public MoreObjects. | |
| public MoreObjects. | |
| public MoreObjects. | |
| public MoreObjects. | |
| public MoreObjects. | |
| private static boolean | |
| public MoreObjects. | |
| public String | toString()
Overrides java. MoreObjects#toStringHelper(Object).
|
| className | back to summary |
|---|---|
| private final String className | |
| holderHead | back to summary |
|---|---|
| private final MoreObjects. | |
| holderTail | back to summary |
|---|---|
| private MoreObjects. | |
| omitEmptyValues | back to summary |
|---|---|
| private boolean omitEmptyValues | |
| omitNullValues | back to summary |
|---|---|
| private boolean omitNullValues | |
| ToStringHelper | back to summary |
|---|---|
| private ToStringHelper(String className) Use | |
| add | back to summary |
|---|---|
| public MoreObjects. Adds a name/value pair to the formatted output in
| |
| add | back to summary |
|---|---|
| public MoreObjects. Adds a name/value pair to the formatted output in
| |
| add | back to summary |
|---|---|
| public MoreObjects. Adds a name/value pair to the formatted output in
| |
| add | back to summary |
|---|---|
| public MoreObjects. Adds a name/value pair to the formatted output in
| |
| add | back to summary |
|---|---|
| public MoreObjects. Adds a name/value pair to the formatted output in
| |
| add | back to summary |
|---|---|
| public MoreObjects. Adds a name/value pair to the formatted output in
| |
| add | back to summary |
|---|---|
| public MoreObjects. Adds a name/value pair to the formatted output in
| |
| addHolder | back to summary |
|---|---|
| private MoreObjects. | |
| addHolder | back to summary |
|---|---|
private MoreObjects.
| |
| addHolder | back to summary |
|---|---|
private MoreObjects.
| |
| addUnconditionalHolder | back to summary |
|---|---|
| private MoreObjects. | |
| addUnconditionalHolder | back to summary |
|---|---|
private MoreObjects.
| |
| addUnconditionalHolder | back to summary |
|---|---|
private MoreObjects.
| |
| addValue | back to summary |
|---|---|
| public MoreObjects. Adds an unnamed value to the formatted output. It is strongly encouraged to use
| |
| addValue | back to summary |
|---|---|
| public MoreObjects. Adds an unnamed value to the formatted output. It is strongly encouraged to use
| |
| addValue | back to summary |
|---|---|
| public MoreObjects. Adds an unnamed value to the formatted output. It is strongly encouraged to use
| |
| addValue | back to summary |
|---|---|
| public MoreObjects. Adds an unnamed value to the formatted output. It is strongly encouraged to use
| |
| addValue | back to summary |
|---|---|
| public MoreObjects. Adds an unnamed value to the formatted output. It is strongly encouraged to use
| |
| addValue | back to summary |
|---|---|
| public MoreObjects. Adds an unnamed value to the formatted output. It is strongly encouraged to use
| |
| addValue | back to summary |
|---|---|
| public MoreObjects. Adds an unnamed value to the formatted output. It is strongly encouraged to use
| |
| isEmpty | back to summary |
|---|---|
| private static boolean isEmpty(Object value) | |
| omitNullValues | back to summary |
|---|---|
| public MoreObjects. Configures the
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a string in the format specified by 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).
| |
| Access | Constructor and Description |
|---|---|
| private |
| UnconditionalValueHolder | back to summary |
|---|---|
| private UnconditionalValueHolder() | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv String | |
| pack-priv MoreObjects. | |
| pack-priv Object |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| name | back to summary |
|---|---|
| pack-priv String name
| |
| next | back to summary |
|---|---|
| pack-priv MoreObjects. | |
| value | back to summary |
|---|---|
| pack-priv Object value
| |
| ValueHolder | back to summary |
|---|---|
| pack-priv ValueHolder() | |