public final class SetOnce<T> extends Object implements Cloneable
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.
|
Modifier and Type | Method and 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.AlreadySetException
SetOnce.AlreadySetException
- if called more than onceset(Object)
public final void set(T obj)
public final T get()
set(Object)
.Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.