Package org.reactfx.value
Class ValBase<T>
- All Implemented Interfaces:
javafx.beans.Observable
,javafx.beans.value.ObservableValue<T>
,Observable<Consumer<? super T>>
,ProperObservable<Consumer<? super T>,
,T> ProperVal<T>
,Val<T>
- Direct Known Subclasses:
AnimatedVal
,FlatMapped
,ListReduction
,MappedVal
,OrElse
,OrElseConst
,SimpleVar
,SuspendableBoolean
,ValWrapper
public abstract class ValBase<T>
extends ObservableBase<Consumer<? super T>,T>
implements ProperVal<T>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract T
protected abstract Subscription
connect()
Implementation of this method should start observing inputs.final T
getValue()
protected final void
protected final void
newObserver
(Consumer<? super T> oldValueObserver) Called for each new observer.protected final Subscription
Starts observing this observable's input(s), if any.Methods inherited from class org.reactfx.ObservableBase
addObserver, enqueueNotifications, equals, forEachObserver, getObserverCount, hashCode, isObservingInputs, notifyObservers, notifyObservers, observe, removeObserver, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.reactfx.Observable
addObserver, observe, removeObserver
Methods inherited from interface org.reactfx.ProperObservable
defaultEquals, defaultHashCode, defaultToString, notifyObservers
Methods inherited from interface org.reactfx.value.ProperVal
defaultNotificationAccumulator
Methods inherited from interface org.reactfx.value.Val
addInvalidationObserver, addListener, addListener, animate, animate, asList, asVar, changes, conditionOn, conditionOnShowing, filter, flatMap, getOpt, getOrElse, getOrSupply, getOrThrow, ifPresent, invalidations, isEmpty, isPresent, map, mapDynamic, observeChanges, observeInvalidations, orElse, orElseConst, pin, removeInvalidationObserver, removeListener, removeListener, selectVar, selectVar, suspendable, values
-
Field Details
-
valid
private boolean valid -
value
-
-
Constructor Details
-
ValBase
public ValBase()
-
-
Method Details
-
getValue
- Specified by:
getValue
in interfacejavafx.beans.value.ObservableValue<T>
-
observeInputs
Description copied from class:ObservableBase
Starts observing this observable's input(s), if any. This method is called when the number of observers goes from 0 to 1. This method is called beforeObservableBase.newObserver(Object)
is called for the first observer.- Specified by:
observeInputs
in classObservableBase<Consumer<? super T>,
T> - Returns:
- subscription used to stop observing inputs. The subscription is unsubscribed (i.e. input observation stops) when the number of observers goes down to 0.
-
invalidate
protected final void invalidate() -
newObserver
Description copied from class:ObservableBase
Called for each new observer. Overriding this method is a convenient way for subclasses to handle this event, for example to publish some initial events.This method is called after the
ObservableBase.observeInputs()
method.- Overrides:
newObserver
in classObservableBase<Consumer<? super T>,
T>
-
connect
Implementation of this method should start observing inputs. If the value of this Val may change as a result of input change, the corresponding input observer should callinvalidate()
to notify observers of this Val. By the time of calling invalidate(), the input observer must have already updated any internal state of this Val, so that a subsequent call tocomputeValue()
returns the current value of this Val.- Returns:
- Subscription that can be used to stop observing inputs.
-
computeValue
-