Class ReactiveVariable<T>

  • Type Parameters:
    T - type of the stored value

    @DraftDocs("link to docs for reactive data sources, reactive computation")
    public class ReactiveVariable<T>
    extends Object
    Reactive data source holding single ReactiveValue. Changes can be observed by using ReactiveTrigger directly or by implementing reactive computation using one of the higher level APIs, for example ReactiveThread.

    ReactiveVariable is also used as a bridge between event-driven code and hookless-based code. Event-driven code can instantiate ReactiveVariable<Object> and call set(new Object()) on it whenever it wants to wake up dependent reactive computations.

    ReactiveVariable is thus a universal reactive primitive rather than just one kind of reactive data source. It is referenced directly in ReactiveScope and ReactiveTrigger. All other reactive data sources internally use ReactiveVariable either to directly store state or to trigger invalidations.

    ReactiveVariable is thread-safe. All methods are safe to call concurrently from multiple threads.

    See Also:
    ReactiveTrigger, ReactiveCollections