|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.util.SetOnce<T>
public final class SetOnce<T>
A convenient class which offers a semi-immutable object wrapper
implementation which allows one to set the value of an object exactly once,
and retrieve it many times. If set(Object)
is called more than once,
SetOnce.AlreadySetException
is thrown and the operation
will fail.
Nested Class Summary | |
---|---|
static class |
SetOnce.AlreadySetException
Thrown when set(Object) is called more than once. |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
T |
get()
Returns the object set by set(Object) . |
void |
set(T obj)
Sets the given object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SetOnce()
set(Object)
.
public SetOnce(T obj)
set(Object)
afterwards will result in
SetOnce.AlreadySetException
SetOnce.AlreadySetException
- if called more than onceset(Object)
Method Detail |
---|
public final void set(T obj)
public final T get()
set(Object)
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |