T - public class Final<T>
extends java.lang.Object
implements java.io.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.
|
java.lang.String |
toString() |
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 valuejava.lang.IllegalArgumentException - if the given value is nulljava.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.Copyright © 2011 OW2 Consortium. All Rights Reserved.