public final class SingleConsumers extends Object
SingleObserver
s.Modifier and Type | Method and Description |
---|---|
static <T> Disposable |
subscribeAutoDispose(Single<T> source,
CompositeDisposable composite,
Consumer<? super T> onSuccess)
Wraps the given onXXX callbacks into a
Disposable Observer ,
adds it to the given CompositeDisposable and ensures, that if the upstream
completes or this particlular Disposable is disposed, the Observer is removed
from the given composite. |
static <T> Disposable |
subscribeAutoDispose(Single<T> source,
CompositeDisposable composite,
Consumer<? super T> onSuccess,
Consumer<? super Throwable> onError)
Wraps the given onXXX callbacks into a
Disposable Observer ,
adds it to the given CompositeDisposable and ensures, that if the upstream
completes or this particlular Disposable is disposed, the Observer is removed
from the given composite. |
public static <T> Disposable subscribeAutoDispose(Single<T> source, CompositeDisposable composite, Consumer<? super T> onSuccess)
Disposable
Observer
,
adds it to the given CompositeDisposable
and ensures, that if the upstream
completes or this particlular Disposable is disposed, the Observer is removed
from the given composite.
The Observer will be removed after the callback for the terminal event has been invoked.
T
- the value typesource
- the source SingleObserver to subscribe to.composite
- the composite Disposable to add and remove the created Disposable ObserveronSuccess
- the callback for upstream itemspublic static <T> Disposable subscribeAutoDispose(Single<T> source, CompositeDisposable composite, Consumer<? super T> onSuccess, Consumer<? super Throwable> onError)
Disposable
Observer
,
adds it to the given CompositeDisposable
and ensures, that if the upstream
completes or this particlular Disposable is disposed, the Observer is removed
from the given composite.
The Observer will be removed after the callback for the terminal event has been invoked.
T
- the value typesource
- the source SingleObserver to subscribe to.composite
- the composite Disposable to add and remove the created Disposable ObserveronSuccess
- the callback for upstream itemsonError
- the callback for an upstream error if any