java.io.Serializable
public final class ValueWrapper
extends java.lang.Object
implements java.io.Serializable
This class only stores the value if it implements Serializable
.
In any case, it stores its runtime type, identity hash code and string
representation, i.e. the result of invoking Object.toString()
.
The toString()
method returns the string representation of the
value along with its type and identity hash code.
System.identityHashCode(java.lang.Object)
,
Serialized FormModifier and Type | Method | Description |
---|---|---|
static ValueWrapper |
create(java.lang.Object value) |
Factory for creating a new
ValueWrapper for the supplied value . |
int |
getIdentityHashCode() |
Returns the value's identity hash code, i.e.
|
java.lang.String |
getStringRepresentation() |
Returns the value's string representation, i.e.
|
java.lang.Class<?> |
getType() |
Returns the value's runtime type in case it wasn't
null ;
otherwise, null . |
java.io.Serializable |
getValue() |
Returns the value as passed to the constructor in case it implemented
Serializable ; otherwise, null . |
java.lang.String |
toString() |
Returns the value's string representation along with its type and
identity hash code.
|
public static ValueWrapper create(java.lang.Object value)
ValueWrapper
for the supplied value
.
If the supplied value
is null
, this method will return a
cached ValueWrapper
suitable for all null values.
value
- the value to wrappublic java.io.Serializable getValue()
Serializable
; otherwise, null
.public java.lang.Class<?> getType()
null
;
otherwise, null
.public java.lang.String getStringRepresentation()
Object.toString()
at the time this object's constructor was
called. Returns "null"
if the value was null
.public int getIdentityHashCode()
System.identityHashCode(java.lang.Object)
at the time this object's constructor
was called. Returns 0
if the value was null
.public java.lang.String toString()
toString
in class java.lang.Object