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> M
getChange()
ObservableValue<V>
getObservable()
V
getOldValue()
V
getValue()
boolean
hasOldValue()
default boolean
isChange()
-
-
-
Method Detail
-
getObservable
ObservableValue<V> getObservable()
- Returns:
- the
ObservableValue
that changed and send this event.
-
getOldValue
V getOldValue()
- Returns:
- the
value
before the change. May benull
if the previous value wasnull
orthe old value is not available
.
-
hasOldValue
boolean hasOldValue()
- Returns:
true
if the old value is available,false
otherwise. For advanced performance the old value is not available for dynamically computedObservableValue
s by default. It is guaranteed to be available if at least one of theregistered
ObservableEventListener
s has calledgetValue()
on the previousObservableEvent
forcing an eager evaluation.
-
getChange
<M> M getChange()
- Type Parameters:
M
- type of the change.- Returns:
- the modification in case of a
value change
,null
otherwise. - See Also:
ListChange
,MapChange
,SetChange
-
isChange
default boolean isChange()
- Returns:
true
if thevalue
object instance itself has changed. MostObservableValue
s contain immutable value types (such asString
,Boolean
,Integer
,BigDecimal
,Instant
, etc.). However, values like e.g.Collection
are mutable and may support notifyingchanges
. Otherwise, iffalse
theobservable
itself was modified and itsvalue
has changed (or was invalidated and needs to be recalculated).- See Also:
getChange()
-
-