BaseObservable

abstract class BaseObservable<R : T, T, OO : ObservableOptional<R>>(observation: Observation<R, T, OO>) : BasicObservable<R, T, OO> , Initial<R, T>

An observable value.

The value that can be observed is of the type ObservableOptional. This is used to distinguish between "no value" ObservableOptional.Nothing and Value ObservableOptional.Value (which could be null).

An initialValue value can be set, which will remain until an actual value is observed. The actual implementation of holding the observed value is done by Observation.

Observable also implements ReadOnlyProperty so it can act as a delegate for an ObservableOptional val

Parameters

T

the type of value to expect.

R

the type of result to expect. Must be a subclass of T.

OO

the type of ObservableOptional to store the result in.

observation

The Observation to handle observing the value.

Inheritors

Constructors

Link copied to clipboard
constructor(initialValue: ObservableOptional<T>)
constructor(observation: Observation<R, T, OO>)

Properties

Link copied to clipboard
open override val currentOrNull: T?

The current value T or null being observed

Link copied to clipboard
open override val initialValue: ObservableOptional<T>

The initial ObservableOptional value of T.

Functions

Link copied to clipboard
abstract operator fun getValue(thisRef: Any?, property: KProperty<*>): OO
Link copied to clipboard
open override fun observe(onNext: (R?) -> Unit): Disposable

Creates an observation that calls onNext each time a new value is observed until the resulting Disposable is disposed