T - Class of the referred-to objectpublic class Ref<T> extends Object implements Serializable
| Constructor and Description |
|---|
Ref(T object)
Construct a
Ref with the given object. |
| Modifier and Type | Method and Description |
|---|---|
static <T> Ref<T> |
create(T object)
Create a new
Ref where the type of the object is inferred from the type of the
argument. |
static boolean |
equal(Object a,
Object b)
Compare two objects for equality, allowing for nulls.
|
boolean |
equals(Object other)
Compare this reference to another for equality.
|
T |
get()
Get the object.
|
T |
getObject()
Get the object (alternative accessor to allow use of the reference in bean-style
accesses).
|
int |
hashCode()
Return the hash code for the
Ref. |
String |
toString()
Return the
String representation of the Ref. |
public Ref(T object)
Ref with the given object.object - the value for the objectpublic T get()
public T getObject()
public String toString()
String representation of the Ref. The default representation
consists of the representation of the referred-to object enclosed in parentheses.toString in class ObjectObject.toString()public int hashCode()
Ref. The default hash code is the hash code of the
referred-to object.hashCode in class ObjectObject.hashCode()public boolean equals(Object other)
equals in class Objectother - the other referencetrue if the other object is non-null, is a Ref to a compatible
object, and that object is equal to thisObject.equals(Object)public static boolean equal(Object a, Object b)
public and static so that it may be used as a comparison of two object
references even when the Ref class is not used.
Note - this method has been superseded since Java 1.7 by
java.util.Objects.equals().
a - the first objectb - the second objecttrue if the first object is equal to the second objectpublic static <T> Ref<T> create(T object)
Ref where the type of the object is inferred from the type of the
argument.T - class of the referred-to objectobject - the value for the objectRefCopyright © 2020. All rights reserved.