public class OptionalValue<T>
extends java.lang.Object
Constructor and Description |
---|
OptionalValue()
Creates a new not initialized instance.
|
OptionalValue(T aValue)
Creates a new instance that is initialized with
the given value.
|
Modifier and Type | Method and Description |
---|---|
T |
get()
Returns the contained value.
|
protected T |
getValue() |
boolean |
hasBeenSet()
Returns true if the contained value has been
explicitly set (even if it is null) or false
if the value has not yet been initialized.
|
boolean |
isNull()
Returns null if the contained value is null.
|
boolean |
isPresent()
Returns true if the value has been set and is not null.
|
void |
set(T aValue)
Sets the contained value to the given value and
marks this object to have been explicitly set.
|
protected void |
setHasBeenSet(boolean hasBeenSet) |
protected void |
setValue(T value) |
public OptionalValue()
public OptionalValue(T aValue)
public boolean hasBeenSet()
public T get()
setHasBeenSet(boolean)
.public void set(T aValue)
setHasBeenSet(boolean)
public boolean isPresent()
public boolean isNull()
protected void setHasBeenSet(boolean hasBeenSet)
protected T getValue()
protected void setValue(T value)