V - Value typeE - Value change event typepublic interface ValueHolder<V,E extends ValueHolder.ValueChangeEvent<V>> extends Serializable
| Modifier and Type | Interface and Description |
|---|---|
static interface |
ValueHolder.ValueChangeEvent<V>
A
ValueHolder.ValueChangeListener event. |
static interface |
ValueHolder.ValueChangeListener<V,E extends ValueHolder.ValueChangeEvent<V>>
A listener for
ValueHolder value change events. |
| Modifier and Type | Method and Description |
|---|---|
com.holonplatform.core.Registration |
addValueChangeListener(ValueHolder.ValueChangeListener<V,E> listener)
Adds a value change listener, called when the value changes.
|
default void |
clear()
Clears this value holder.
|
default V |
getEmptyValue()
Returns the value that represents an empty value.
|
V |
getValue()
Gets the current value of this value holder.
|
default Optional<V> |
getValueIfPresent()
Gets the value as an
Optional, which will be empty if the value holder is considered to be empty or the
value is null. |
default boolean |
isEmpty()
Returns whether this value holder is considered to be empty, according to its current value.
|
void |
setValue(V value)
Sets the
value of this value holder. |
void setValue(V value)
value of this value holder.value - the value to setIllegalArgumentException - if the value is not validV getValue()
default Optional<V> getValueIfPresent()
Optional, which will be empty if the value holder is considered to be empty or the
value is null.default V getEmptyValue()
null by default)default boolean isEmpty()
By default this is an equality check between current value and empty value.
true if considered empty, false if notdefault void clear()
By default, resets the value to the empty one.
com.holonplatform.core.Registration addValueChangeListener(ValueHolder.ValueChangeListener<V,E> listener)
listener - the value change listener to add (not null)Copyright © 2019 The Holon Platform. All rights reserved.