T - The type of the valuepublic class Setting<T> extends Object
final Setting<T> instead
of a final T property, if the value is not known when the object is constructed, but otherwise behaves
like a final property. A setting reference is thread-safe.| Constructor and Description |
|---|
Setting(String name)
Creates a new
Setting instance. |
Setting(String name,
Expression<T> defaultExpression)
Creates a new
Setting instance. |
Setting(String name,
T defaultValue)
Creates a new
Setting instance. |
| Modifier and Type | Method and Description |
|---|---|
T |
get()
Returns the value of this setting.
|
boolean |
isFixated()
Returns a flag that indicates whether the value of this setting is already fixated.
|
boolean |
offer(T value)
Offers the value as a candidate for the reference.
|
void |
set(T value)
Sets the value, if possible.
|
String |
toString() |
public Setting(String name, Expression<T> defaultExpression)
Setting instance. The default value is used in case the setting is not set before the
getter is called.name - A label for the settingdefaultExpression - An expression that lazily returns a default valuepublic Setting(String name, T defaultValue)
Setting instance. The default value is used in case the setting is not set before the
getter is called.name - A label for the settingdefaultValue - The default valuepublic Setting(String name)
Setting instance.name - A label for the settingpublic void set(T value)
value - The value to setIllegalStateException - If the reference was already set to another valuepublic T get()
IllegalStateException
is thrown.IllegalStateExceptionpublic boolean isFixated()
true if the value is fixated; false otherwisepublic boolean offer(T value)
value - The candidate value for this settingtrue if the given value is equal to the value of the setting; false otherwiseCopyright © 2013. All Rights Reserved.