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 | Description |
|---|---|---|
static class |
SetOnce.AlreadySetException |
Thrown when
set(Object) is called more than once. |
| Constructor | 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.
|
| Modifier and Type | Method | Description |
|---|---|---|
T |
get() |
Returns the object set by
set(Object). |
void |
set(T obj) |
Sets the given object.
|
public SetOnce()
set(Object).public SetOnce(T obj)
set(Object) afterwards will result in
SetOnce.AlreadySetExceptionSetOnce.AlreadySetException - if called more than onceset(Object)public final void set(T obj)
public final T get()
set(Object).Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.