T - the type of object being wrappedpublic class Obj<T> extends java.lang.Object implements Bool
| Modifier and Type | Field and Description |
|---|---|
static Obj<java.lang.Object> |
NULL
A single variable representing all objects that wrap null.
|
| Constructor and Description |
|---|
Obj(T object)
Creates a wrapper for the given object.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object other)
Returns whether the other object is equal to the wrapped object, including whether they are
both null.
|
T |
get()
Returns the wrapped object.
|
int |
hashCode()
Returns the hash code of the wrapped object.
|
boolean |
isEmpty()
Returns whether the wrapped object is null or is a string or collection of zero length.
|
boolean |
isFalse()
Returns whether the wrapped object is null or is a string or collection of zero length.
|
boolean |
isNotNull()
Returns whether the wrapped object is not null.
|
boolean |
isNull()
Returns whether the wrapped object is null.
|
boolean |
isTrue()
Returns whether the wrapped object is non-null and, if it is a collection or a string, has a
length greater than zero.
|
T |
obj()
Returns the wrapped object.
|
static <T> Obj<T> |
of(T obj)
Creates a wrapper for the given object.
|
java.lang.String |
toString()
Returns the wrapped object as a string.
|
public static Obj<java.lang.Object> NULL
public Obj(T object)
object - the object to wrappublic static <T> Obj<T> of(T obj)
NULL is returned, thus eliminating unnecessary object creation.T - the type of object being wrappedobj - the object being wrappedNULLpublic boolean equals(java.lang.Object other)
other is a Obj, then its wrapped object is
compared.equals in class java.lang.Objectother - the object to compare to the wrapped objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean isTrue()
public boolean isFalse()
public boolean isEmpty()
public boolean isNull()
isNotNull()public boolean isNotNull()
isNull()public java.lang.String toString()
"[abc, def, ghi]"
instead of "[Ljava.lang.Object;@15db9742".toString in class java.lang.Object