T - public class Final<T> extends Object implements Serializable
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 and Description |
|---|
Final() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
String |
toString() |
protected T getValue()
protected void setValue(T t)
t - the value to set this variable to.public void init(T t)
t - the valueIllegalArgumentException - if the given value is nullIllegalStateException - if the variable has already been set.public T get()
public boolean isInitialized()
true if this final variable has been initialized,
false otherwise.Copyright © 2012 OW2 Consortium. All Rights Reserved.