public final class SetOnce<T> extends Object
set(Object)
is called more than once,
SetOnce.AlreadySetException
is thrown and the operation
will fail.Modifier and Type | Class and Description |
---|---|
static class |
SetOnce.AlreadySetException
Thrown when
set(Object) is called more than once. |
Constructor and Description |
---|
SetOnce()
A default constructor which does not set the internal object, and allows
setting it by calling
set(Object) . |
SetOnce(T obj)
Creates a new instance with the internal object set to the given object.
|
public SetOnce()
set(Object)
.public SetOnce(T obj)
set(Object)
afterwards will result in
SetOnce.AlreadySetException
SetOnce.AlreadySetException
- if called more than onceset(Object)
public final void set(T obj)
public final T get()
set(Object)
.