public final class ValueWrapper extends Object implements 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 and Description |
---|---|
static ValueWrapper |
create(Object value)
Factory for creating a new
ValueWrapper for the supplied value . |
int |
getIdentityHashCode()
Returns the value's identity hash code, i.e.
|
String |
getStringRepresentation()
Returns the value's string representation, i.e.
|
Class<?> |
getType()
Returns the value's runtime type in case it wasn't
null ;
otherwise, null . |
Serializable |
getValue()
Returns the value as passed to the constructor in case it implemented
Serializable ; otherwise, null . |
String |
toString()
Returns the value's string representation along with its type and
identity hash code.
|
public static ValueWrapper create(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 Serializable getValue()
Serializable
; otherwise, null
.public Class<?> getType()
null
;
otherwise, null
.public 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
.