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 Tprotected abstract Subscriptionconnect()Implementation of this method should start observing inputs.final TgetValue()protected final voidprotected final voidnewObserver(Consumer<? super T> oldValueObserver) Called for each new observer.protected final SubscriptionStarts observing this observable's input(s), if any.Methods inherited from class ObservableBase
addObserver, enqueueNotifications, equals, forEachObserver, getObserverCount, hashCode, isObservingInputs, notifyObservers, notifyObservers, observe, removeObserver, toStringMethods inherited from interface Observable
addObserver, observe, removeObserverMethods inherited from interface ProperObservable
defaultEquals, defaultHashCode, defaultToString, notifyObserversMethods inherited from interface ProperVal
defaultNotificationAccumulatorMethods inherited from interface 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
-
observeInputs
Description copied from class:ObservableBaseStarts 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:
observeInputsin 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:ObservableBaseCalled 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:
newObserverin 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
-