public final class Values
extends java.lang.Object
Value
objectsModifier and Type | Class and Description |
---|---|
static class |
Values.AbstractObservableValue<V>
A base Value implementation handling the
ValueObserver for a Value. |
static class |
Values.AbstractValue<V>
A base Value implementation handling everything except the value itself.
|
Modifier and Type | Method and Description |
---|---|
static <V> void |
link(Value<V> originalValue,
Value<V> linkedValue)
Links the two values together so that changes in one are reflected in the other
|
static <V> void |
link(Value<V> originalValue,
Value<V> linkedValue,
boolean oneWay)
Links the two values together so that changes in one are reflected in the other
|
static <V> Value<V> |
propertyValue(java.lang.Object owner,
java.lang.String propertyName,
java.lang.Class<V> valueClass,
EventObserver<V> valueChangeEvent)
Instantiates a new Value based on a class property
|
static Value<java.lang.Boolean> |
stateValue(State state)
Instantiates a boolean Value based on a
State . |
static <V> Value<V> |
value()
Instantiates a new Value instance wrapping a null initial value
|
static <V> Value<V> |
value(V initialValue)
Instantiates a new Value
|
static <V> Value<V> |
value(V initialValue,
V nullValue)
Instantiates a new Value
|
static <V> ValueObserver<V> |
valueObserver(Value<V> value)
Instantiates a new ValueObserver for the given value.
|
static State |
valueState(Value<java.lang.Boolean> booleanValue)
Instantiates a State linked to the given boolean value.
|
public static <V> Value<V> value()
V
- type to wrappublic static <V> Value<V> value(V initialValue)
V
- type to wrapinitialValue
- the initial valuepublic static <V> Value<V> value(V initialValue, V nullValue)
V
- type to wrapinitialValue
- the initial valuenullValue
- the actual value to use when the value is set to nullpublic static <V> Value<V> propertyValue(java.lang.Object owner, java.lang.String propertyName, java.lang.Class<V> valueClass, EventObserver<V> valueChangeEvent)
V
- type to wrapowner
- the property ownerpropertyName
- the name of the propertyvalueClass
- the value classvalueChangeEvent
- an event which fires each time the value changespublic static Value<java.lang.Boolean> stateValue(State state)
State
.
Null values are translated to 'false'.state
- the state to base the value onpublic static State valueState(Value<java.lang.Boolean> booleanValue)
booleanValue
- the boolean value to link to the statepublic static <V> ValueObserver<V> valueObserver(Value<V> value)
V
- the value typevalue
- the value to observepublic static <V> void link(Value<V> originalValue, Value<V> linkedValue)
V
- the value typeoriginalValue
- the original valuelinkedValue
- the linked valuepublic static <V> void link(Value<V> originalValue, Value<V> linkedValue, boolean oneWay)
V
- the value typeoriginalValue
- the original valuelinkedValue
- the linked valueoneWay
- if true the original value is not updated if the linked value changes