|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ow2.orchestra.util.Final<T>
T - public class Final<T>
This class provides an efficient way --- using hardware
instructions if available --- for holding a variable that can only
be initialized once (aka: final variables).
This class helps when it is not possible to declare a variable as
final but still, you need it to be initialized only
once (e.g: in a setter).
Note that you cannot initialize a variable to null
using this class.
This class is thread safe.
| Constructor Summary | |
|---|---|
Final()
|
|
| Method Summary | |
|---|---|
T |
get()
Return the value of the initialized variable. |
protected T |
getValue()
Return the current value of this variable. |
void |
init(T t)
Initialize this variable to the given value. |
boolean |
isInitialized()
Check the initialized status of this final variable. |
protected void |
setValue(T t)
Set the value of this variable directly. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Final()
| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Objectprotected T getValue()
protected void setValue(T t)
t - the value to set this variable to.public void init(T t)
t - the value
java.lang.IllegalArgumentException - if the given value is null
java.lang.IllegalStateException - if the variable has already been set.public T get()
public boolean isInitialized()
true if this final variable has been initialized,
false otherwise.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||