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 ObservableP
- observer type accepted by the underlying ObservableU
- 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 java.lang.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 Summary
Fields Modifier and Type Field Description private U
underlying
-
Constructor Summary
Constructors Modifier Constructor Description protected
ProxyObservable(U underlying)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract P
adaptObserver(O observer)
Adapts the given observer to observer of the underlying Observable.void
addObserver(O observer)
protected U
getUnderlyingObservable()
Subscription
observe(O observer)
void
removeObserver(O observer)
-
-
-
Field Detail
-
underlying
private final U extends Observable<P> underlying
-
-
Constructor Detail
-
ProxyObservable
protected ProxyObservable(U underlying)
-
-
Method Detail
-
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 interfaceObservable<O>
-
removeObserver
public final void removeObserver(O observer)
- Specified by:
removeObserver
in interfaceObservable<O>
-
observe
public final Subscription observe(O observer)
- Specified by:
observe
in interfaceObservable<O>
-
-