Package com.google.api.client.util
Class Objects
- java.lang.Object
-
- com.google.api.client.util.Objects
-
public final class Objects extends java.lang.ObjectHelper functions that can operate on anyObject.- Since:
- 1.14
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classObjects.ToStringHelperSupport class fortoStringHelper(java.lang.Object).
-
Constructor Summary
Constructors Modifier Constructor Description privateObjects()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanequal(java.lang.Object a, java.lang.Object b)Determines whether two possibly-null objects are equal.static Objects.ToStringHelpertoStringHelper(java.lang.Object self)Creates an instance ofObjects.ToStringHelper.
-
-
-
Method Detail
-
equal
public static boolean equal(java.lang.Object a, java.lang.Object b)Determines whether two possibly-null objects are equal. Returns:trueifaandbare both null.trueifaandbare both non-null and they are equal according toObject.equals(Object).falsein all other situations.
This assumes that any non-null objects passed to this function conform to the
equals()contract.
-
toStringHelper
public static Objects.ToStringHelper toStringHelper(java.lang.Object self)
Creates an instance ofObjects.ToStringHelper.This is helpful for implementing
Object.toString(). Specification by example:// Returns "ClassName{}" Objects.toStringHelper(this) .toString(); // Returns "ClassName{x=1}" Objects.toStringHelper(this) .add("x", 1) .toString(); // Returns "MyObject{x=1}" Objects.toStringHelper("MyObject") .add("x", 1) .toString(); // Returns "ClassName{x=1, y=foo}" Objects.toStringHelper(this) .add("x", 1) .add("y", "foo") .toString(); // Returns "ClassName{x=1}" Objects.toStringHelper(this) .omitNullValues() .add("x", 1) .add("y", null) .toString();- Parameters:
self- the object to generate the string for (typicallythis), used only for its class name
-
-