T
- the type of the valuepublic interface ObservableValue<T> extends Observable<T>
fetched
and observed for updates and
changes
.
Observable value adheres to the contract of Observable
, with a few
extra restrictions on its behavior to conform to the semantics of a mutable
value.
An instance may send a completion
event to
indicate that it will not mutate beyond that point, but it should only send
this to an observer if it has already sent them a message event containing
the current value.
The value may enter an error state, in which case observers will receive a
failure event
and subsequent calls to
get()
should throw a MissingValueException
as per
Observable.get()
until a new valid value is available.
A common example of an error state may be NullPointerException
when
there is no value available.
The observable should always be primed with either a message event or a
failure event immediately upon instantiation, and observers which subscribe
to the observable should receive the last such event directly subsequent to
observation. This means that the get()
method inherited from
observable should never have to block.
Observable values should never support backpressure.
Modifier and Type | Interface and Description |
---|---|
static interface |
ObservableValue.Change<T>
A value change event.
|
Modifier and Type | Method and Description |
---|---|
Observable<ObservableValue.Change<T>> |
changes() |
T |
get()
Immediately resolve the current value if one exists, otherwise throw a
MissingValueException with a cause representing the current failure
state. |
default java.lang.Throwable |
getProblem() |
default boolean |
isEqual(T value) |
default boolean |
isMatching(java.util.function.Predicate<? super T> value) |
default boolean |
isValid() |
default java.util.Optional<T> |
tryGet()
Immediately resolve the current value, if one exists.
|
default java.util.Optional<java.lang.Throwable> |
tryGetProblem() |
aggregateBackpressure, aggregateBackpressure, collect, collectBackpressure, compose, concat, concat, concatMap, dropWhile, empty, executeOn, failingValue, filter, flatMap, getNext, map, materialize, merge, merge, mergeMap, observe, observe, of, of, of, reduce, reduceBackpressure, reduceBackpressure, reduceBackpressure, repeating, requestNext, requestUnbounded, retrying, softReference, softReference, synchronize, synchronize, takeWhile, then, thenAfter, toObservable, toValue, toValue, toValue, upcast, value, weakReference, weakReference
T get()
MissingValueException
with a cause representing the current failure
state.get
in interface Observable<T>
default java.util.Optional<T> tryGet()
tryGet
in interface Observable<T>
default boolean isValid()
default boolean isEqual(T value)
default boolean isMatching(java.util.function.Predicate<? super T> value)
default java.lang.Throwable getProblem()
default java.util.Optional<java.lang.Throwable> tryGetProblem()
Observable<ObservableValue.Change<T>> changes()