Package org.reactfx

Class ConnectableEventSource<T>

java.lang.Object
org.reactfx.ObservableBase<Consumer<? super T>,T>
org.reactfx.EventStreamBase<T>
org.reactfx.ConnectableEventSource<T>
All Implemented Interfaces:
Connectable<T>, ConnectableEventSink<T>, ConnectableEventStream<T>, EventSink<T>, EventStream<T>, Observable<Consumer<? super T>>, ProperEventStream<T>, ProperObservable<Consumer<? super T>,T>

public final class ConnectableEventSource<T> extends EventStreamBase<T> implements ConnectableEventStream<T>, ConnectableEventSink<T>
  • Field Details

  • Constructor Details

    • ConnectableEventSource

      public ConnectableEventSource()
  • Method Details

    • push

      public final void push(T value)
      Specified by:
      push in interface EventSink<T>
    • connectTo

      public Subscription connectTo(EventStream<? extends T> input)
      Description copied from interface: Connectable
      Connects this connectable object to source event stream. Implementations of this method should subscribe to source lazily, i.e. only subscribe to source when necessary, e.g. when the connectable object itself is being observed (e.g. itself has at least one subscriber).

      A Connectable may be connected to multiple sources at the same time.

      Specified by:
      connectTo in interface Connectable<T>
      Parameters:
      input - event stream to (lazily) connect to.
      Returns:
      subscription that can be used to disconnect this connectable object from source.
    • observeInputs

      protected final Subscription 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 before ObservableBase.newObserver(Object) is called for the first observer.
      Specified by:
      observeInputs in class ObservableBase<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.
    • subscribeToInput

      private final Subscription subscribeToInput(EventStream<? extends T> input)