public final class Observables
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <T> Observable<T> |
create(Func1<Observer<? super T>,? extends java.io.Closeable> registerer)
Create an observable instance by submitting a function which takes responsibility
for registering observers and returns a custom Closeable to terminate the registration.
|
static <T> Observable<T> |
createWithAction(Func1<Observer<? super T>,? extends Action0> register)
Create an observable instance by submitting a function which takes responsibility
for registering observers.
|
static <T> Observable<T> |
createWithActionE(Func1<Observer<? super T>,? extends Action0E<? extends java.io.IOException>> registerer)
Create an observable instance by submitting a function which takes responsibility
for registering observers and returns a custom Closeable to terminate the registration.
|
static <T> Observable<T> |
toObservable(java.util.Observable javaObservable)
Converts the original Java Observable into an reactive-Observable instance.
|
static <T> OriginalObservableWrapper<T> |
toOriginalObservable(Observable<T> source)
Converts the reactive-observable into the original Java Observable.
|
static <T> OriginalObservableWrapper<T> |
toOriginalObservable(Observable<T> source,
boolean unregisterObservers)
Converts the reactive-observable into the original Java Observable.
|
@Nonnull public static <T> Observable<T> toObservable(@Nonnull java.util.Observable javaObservable)
Note that since java-observables are not generic, ClassCastException might occur if the transmitted value has incompatible class.
T - the element typejavaObservable - the java-observable to be used@Nonnull public static <T> OriginalObservableWrapper<T> toOriginalObservable(@Nonnull Observable<T> source)
Since java-observables are always active, the source sequence is immediately registered. In order to have a java-observable that activates once the first observer registers, supply this method with a Reactive.refCount() wrapped observable. The returned java-observable implements Closeable which can be used to terminate the connection to source and deregister all observers
Incoming error and finish events will close the connection to the source and deregister all observers.
T - the observable sequence typesource - the source sequence of anythingHybridSubject@Nonnull public static <T> OriginalObservableWrapper<T> toOriginalObservable(@Nonnull Observable<T> source, boolean unregisterObservers)
Since java-observables are always active, the source sequence is immediately registered. In order to have a java-observable that activates once the first observer registers, supply this method with a Reactive.refCount() wrapped observable. The returned java-observable implements Closeable which can be used to terminate the connection to source and deregister all observers
Incoming error and finish events are ignored if unregisterObservers is false, or they will cause deregistration otherwise.
T - the observable sequence typesource - the source sequence of anythingunregisterObservers - should the registered observers deregistered
in case of an error or finish message or closing the observer?HybridSubject@Nonnull public static <T> Observable<T> createWithAction(@Nonnull Func1<Observer<? super T>,? extends Action0> register)
T - the type of the value to observeregister - the function to manage new registrations@Nonnull public static <T> Observable<T> create(@Nonnull Func1<Observer<? super T>,? extends java.io.Closeable> registerer)
T - the type of the value to observeregisterer - the function to manage new registrations@Nonnull public static <T> Observable<T> createWithActionE(@Nonnull Func1<Observer<? super T>,? extends Action0E<? extends java.io.IOException>> registerer)
T - the type of the value to observeregisterer - the function to manage new registrations