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,
java.util.function.Supplier<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.
|
protected <Q> Q |
getInternal(java.util.function.Function<T,Q> successCase,
java.util.function.Supplier<Q> failureCase) |
protected org.slf4j.Logger |
getLogger() |
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.
|
protected T |
offerInternal(T value) |
void |
set(T value)
Sets the value, if possible.
|
String |
toString() |
public Setting(String name, java.util.function.Supplier<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.IllegalStateException - When the value is not setpublic boolean isFixated()
true if the value is fixated; false otherwiseprotected <Q> Q getInternal(java.util.function.Function<T,Q> successCase, java.util.function.Supplier<Q> failureCase)
public boolean offer(T value)
value - The candidate value for this settingtrue if the given value is equal to the value of the setting; false otherwiseprotected org.slf4j.Logger getLogger()
Copyright © 2014. All rights reserved.