public final class XObjects extends Object
Objects.| Modifier and Type | Class and Description |
|---|---|
static class |
XObjects.ToStringBuilder
Helper class for
Object.toString()'s implementations. |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
equal(Object a,
Object b)
Returns
true if the given objects are both null or if
they are equal, false in all other cases. |
static <T> T |
firstNonNull(T... refs)
Returns the first of the given references that is not
null. |
static int |
hashCode(Object... objects)
Returns a hash code for the given
Objects. |
static String |
toString(Object o)
Returns a
String representation of the given object obtained
by calling its Object.toString() method if it's a "regular"
object or by calling the appropriate Arrays' toString
method if it's an array, returns "null" if it's null. |
static String |
toString(Object o,
String ifNull)
Returns a
String representation of the given object obtained
by calling its Object.toString() method if it's a "regular"
object or by calling the appropriate Arrays' toString
method if it's an array, returns ifNull if it's null. |
static XObjects.ToStringBuilder |
toStringBuilder(Object self)
Returns a
XObjects.ToStringBuilder for the given object. |
static XObjects.ToStringBuilder |
toStringBuilder(String name)
Returns a
XObjects.ToStringBuilder with the given name. |
public static <T> T firstNonNull(T... refs)
null.
If all are null, null is returned.T - the type of the given references.refs - the references to test for nullity.null reference.public static boolean equal(Object a, Object b)
true if the given objects are both null or if
they are equal, false in all other cases. If a and
b are arrays, they are compared using the appropriate
Arrays' equals method.a - the first object.b - the second object.null objects are equal.public static int hashCode(Object... objects)
Objects.objects - the Objects to compute a hash code for.Objects.public static String toString(Object o)
String representation of the given object obtained
by calling its Object.toString() method if it's a "regular"
object or by calling the appropriate Arrays' toString
method if it's an array, returns "null" if it's null.public static String toString(Object o, String ifNull)
String representation of the given object obtained
by calling its Object.toString() method if it's a "regular"
object or by calling the appropriate Arrays' toString
method if it's an array, returns ifNull if it's null.public static XObjects.ToStringBuilder toStringBuilder(Object self)
XObjects.ToStringBuilder for the given object.self - the object to generate its string representation.XObjects.ToStringBuilder.NullPointerException - if self is null.public static XObjects.ToStringBuilder toStringBuilder(String name)
XObjects.ToStringBuilder with the given name.name - the object to generate its string representation.XObjects.ToStringBuilder.NullPointerException - if name is null.Copyright © 2012–2015. All rights reserved.