Package io.github.mmm.value.observable
Interface ObservableEvent<V>
-
- Type Parameters:
V- type of observedvalue.
public interface ObservableEvent<V>Event notifying about changes of anObservableValue.- Since:
- 1.0.0
- See Also:
ObservableEventListener,ObservableValue
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <M> MgetChange()ObservableValue<V>getObservable()VgetOldValue()VgetValue()booleanhasOldValue()default booleanisChange()
-
-
-
Method Detail
-
getObservable
ObservableValue<V> getObservable()
- Returns:
- the
ObservableValuethat changed and send this event.
-
getOldValue
V getOldValue()
- Returns:
- the
valuebefore the change. May benullif the previous value wasnullorthe old value is not available.
-
hasOldValue
boolean hasOldValue()
- Returns:
trueif the old value is available,falseotherwise. For advanced performance the old value is not available for dynamically computedObservableValues by default. It is guaranteed to be available if at least one of theregisteredObservableEventListeners has calledgetValue()on the previousObservableEventforcing an eager evaluation.
-
getChange
<M> M getChange()
- Type Parameters:
M- type of the change.- Returns:
- the modification in case of a
value change,nullotherwise. - See Also:
ListChange,MapChange,SetChange
-
isChange
default boolean isChange()
- Returns:
trueif thevalueobject instance itself has changed. MostObservableValues contain immutable value types (such asString,Boolean,Integer,BigDecimal,Instant, etc.). However, values like e.g.Collectionare mutable and may support notifyingchanges. Otherwise, iffalsetheobservableitself was modified and itsvaluehas changed (or was invalidated and needs to be recalculated).- See Also:
getChange()
-
-