Package org.reactfx

Class ProxyObservable<O,P,U extends Observable<P>>

java.lang.Object
org.reactfx.ProxyObservable<O,P,U>
Type Parameters:
O - observer type accepted by this Observable
P - observer type accepted by the underlying Observable
U - type of the underlying observable to which observers are delegated
All Implemented Interfaces:
Observable<O>
Direct Known Subclasses:
ProxyVal

public abstract class ProxyObservable<O,P,U extends Observable<P>> extends Object implements Observable<O>
An Observable that does not maintain its own collection of observers, but rather adapts and registers every given observer with the underlying Observable
  • Field Details

    • underlying

      private final U extends Observable<P> underlying
  • Constructor Details

    • ProxyObservable

      protected ProxyObservable(U underlying)
  • Method Details

    • adaptObserver

      protected abstract P adaptObserver(O observer)
      Adapts the given observer to observer of the underlying Observable.

      Important: It is required that the transformation applied to two observers that are _equal_ yields two adapted observers that are _equal_. In other words, if `o1.equals(o2)`, then it must be the case that `adaptObserver(o1).equals(adaptObserver(o2))`.

      Parameters:
      observer - observer to be adapted for the underlying Observable
      Returns:
      observer adapted for the underlying Observable
    • getUnderlyingObservable

      protected final U getUnderlyingObservable()
    • addObserver

      public final void addObserver(O observer)
      Specified by:
      addObserver in interface Observable<O>
    • removeObserver

      public final void removeObserver(O observer)
      Specified by:
      removeObserver in interface Observable<O>
    • observe

      public final Subscription observe(O observer)
      Specified by:
      observe in interface Observable<O>