public abstract class AbstractRxHub extends java.lang.Object implements RxHub
RxHub
Essentially this is a collection of Observable nodes which can also subscribe to other
Observables and pass events to their Subscribers
Nodes can be either Subject or Relay. Nodes are identified by their Tags.
Nodes subscribes to Observables however each subscription created is
per RxHub.Source. A Source is identified by Observable and a Tag.
For example when Observable A is added with Tag T1 and Tag T2. Two nodes are created receiving
the same events. Each of those nodes can be used and unsubscribed from Observable A
independently.
Observers subscribe to a Node. Observers does not need to know about the source of the Events
i.e the Observers that the Nodes is subscribed to.
To fetch the Node to subscribe to getNode(Object) must be called.
Non-Rx code can also call emit(Object, Object) to manually emit Events
through specific Node.RxHub.NodeType, RxHub.Source| Constructor and Description |
|---|
AbstractRxHub() |
| Modifier and Type | Method and Description |
|---|---|
void |
addProvider(java.lang.Object tag,
rx.Observable provider)
Subscribes Node to
Observable. |
void |
clearProviders()
Clears all subscriptions of all Nodes
|
void |
emit(java.lang.Object tag,
java.lang.Object event)
Manually emit event to a specific Node.
|
rx.Observable |
getNode(java.lang.Object tag)
Returns the Node Observable identified by the tag
|
<T> rx.Observable<T> |
getNodeFiltered(java.lang.Object tag,
java.lang.Class<T> filterClass)
Type safe variant of
RxHub.getNode(Object). |
void |
removeProvider(java.lang.Object tag,
rx.Observable provider)
Unsubscribe
Observable from a Node |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcanTriggerEmit, getNodeType, isNodeThreadsafepublic final void addProvider(java.lang.Object tag,
rx.Observable provider)
RxHubObservable.
If there is no Node with the specific tag a new one will be created
except if the node is of type RxHub.NodeType.ObservableRefaddProvider in interface RxHubtag - the ID of the Nodeprovider - the Observable to subscribe topublic final void removeProvider(java.lang.Object tag,
rx.Observable provider)
RxHubObservable from a NoderemoveProvider in interface RxHubtag - the ID of the Nodeprovider - the Observable to unsubscribe frompublic final rx.Observable getNode(java.lang.Object tag)
RxHubpublic final <T> rx.Observable<T> getNodeFiltered(java.lang.Object tag,
java.lang.Class<T> filterClass)
RxHubRxHub.getNode(Object).
Returns the Node Observable identified by the tag and filtered by the Class providedgetNodeFiltered in interface RxHubT - the Type of the events the returned Observable will emittag - the ID of the NodefilterClass - the Class to filter the observable bypublic final void emit(java.lang.Object tag,
java.lang.Object event)
RxHubpublic final void clearProviders()
RxHubclearProviders in interface RxHub