T
- type of the valuepublic final class Nullable<T> extends Object implements Distributable, Serializable
null
.
This is actually not necessary in Java because all object type references
can be assigned null
, however this class may be useful when an
object type cannot be null
(For example, frameworks to send
messages between JVMs may require messages to be non-null).
This class is Serializable
, however to accomplish Serialization the
generic argument should also be.
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
T |
getValue()
Gets the value.
|
int |
hashCode() |
static <T> Nullable<T> |
nullValue()
Factory method that creates a Nullable with
null value. |
String |
toString() |
static <T> Nullable<T> |
valueOf(T value)
Factory method that creates a Nullable with a non-null value.
|
public static <T> Nullable<T> nullValue()
null
value.null
valuepublic static <T> Nullable<T> valueOf(T value)
value
- valuepublic T getValue()
Copyright © 2015. All Rights Reserved.