java.lang.Object
io.github.mmm.event.AbstractEventSource<ObservableEvent<V>,ObservableEventListener<? super V>>
io.github.mmm.value.observable.AbstractObservableValue<V>
io.github.mmm.value.observable.Binding<V>
- Type Parameters:
V- type of the observablevalue.
- All Implemented Interfaces:
EventSource<ObservableEvent<V>,,ObservableEventListener<? super V>> Expression<V>,ObservableValue<V>,ReadableValue<V>,Supplier<V>
- Direct Known Subclasses:
BooleanBinding,DurationBinding,InstantBinding,LocalDateBinding,LocalDateTimeBinding,LocalTimeBinding,NumberBinding,OffsetDateTimeBinding,OffsetDateTimeBinding,PatternBinding,StringBinding,ZonedDateTimeBinding
- Since:
- 1.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionBinding(Supplier<? extends V> expression, ObservableValue<?>... dependencies) The constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidbind(ObservableValue<?>... observables) Start observing the dependencies for changes.voiddispose()Called if thisExpressionwill not be used anymore and any references can be removed.get()protected final voidInvalidates this observable in case it's value is computed.protected final booleanisValid()voidprotected final voidunbind(ObservableValue<?>... observables) Stop observing the dependencies for changes.Methods inherited from class io.github.mmm.value.observable.AbstractObservableValue
addListener, fireChange, fireEvent, fireEvent, fireEventFor, fireEventFor, fireEventWithOldValue, hasChangeAwareListeners, removeListener, toStringMethods inherited from class io.github.mmm.event.AbstractEventSource
getEventAdapter, hasListenersMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.github.mmm.event.EventSource
addListener, addListener, addWeakListener, removeListenerMethods inherited from interface io.github.mmm.value.observable.Expression
asString, isEqualTo, isEqualTo, isNotEqualTo, isNotEqualTo, isNotNull, isNullMethods inherited from interface io.github.mmm.value.ReadableValue
getSafe
-
Constructor Details
-
Binding
The constructor.- Parameters:
expression- theSupplierto compute thevalue.dependencies- theObservableValues theexpressiondepends on.
-
-
Method Details
-
bind
Start observing the dependencies for changes. If the value of one of the dependencies changes, the binding is marked as invalid.- Parameters:
observables- the dependencies to observe
-
unbind
Stop observing the dependencies for changes.- Parameters:
observables- the dependencies to stop observing
-
dispose
public void dispose()Description copied from interface:ExpressionCalled if thisExpressionwill not be used anymore and any references can be removed. AnyObservableEventListeneraddedto dependentObservableValues will beremoved.- Specified by:
disposein interfaceExpression<V>
-
get
-
invalidate
protected final void invalidate()Description copied from class:AbstractObservableValueInvalidates this observable in case it's value is computed.- Overrides:
invalidatein classAbstractObservableValue<V>
-
isValid
protected final boolean isValid()- Returns:
trueif the cachedvalueis still valid,falseotherwise (re-calculation required).
-
toString
- Specified by:
toStringin interfaceObservableValue<V>- Overrides:
toStringin classAbstractObservableValue<V>- Parameters:
sb- theStringBuilderwhere to append the details of this property forAbstractObservableValue.toString()-Representation.
-