Class CompletableConsumers


  • public final class CompletableConsumers
    extends java.lang.Object
    Utility methods for creating and using consumers Completables.
    Since:
    0.18.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Disposable subscribeAutoDispose​(Completable source, CompositeDisposable composite, Action onComplete)
      Wraps the given onXXX callbacks into a Disposable CompletableObserver, adds it to the given CompositeDisposable and ensures, that if the upstream completes or this particlular Disposable is disposed, the CompletableObserver is removed from the given composite.
      static Disposable subscribeAutoDispose​(Completable source, CompositeDisposable composite, Action onComplete, Consumer<? super java.lang.Throwable> onError)
      Wraps the given onXXX callbacks into a Disposable CompletableObserver, adds it to the given CompositeDisposable and ensures, that if the upstream completes or this particlular Disposable is disposed, the CompletableObserver is removed from the given composite.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • subscribeAutoDispose

        public static Disposable subscribeAutoDispose​(Completable source,
                                                      CompositeDisposable composite,
                                                      Action onComplete)
        Wraps the given onXXX callbacks into a Disposable CompletableObserver, adds it to the given CompositeDisposable and ensures, that if the upstream completes or this particlular Disposable is disposed, the CompletableObserver is removed from the given composite.

        The CompletableObserver will be removed after the callback for the terminal event has been invoked.

        Parameters:
        source - the source Completable to subscribe to.
        composite - the composite Disposable to add and remove the created Disposable CompletableObserver
        onComplete - the callback for when the upstream completes
        Returns:
        the Disposable that allows disposing the particular subscription.
      • subscribeAutoDispose

        public static Disposable subscribeAutoDispose​(Completable source,
                                                      CompositeDisposable composite,
                                                      Action onComplete,
                                                      Consumer<? super java.lang.Throwable> onError)
        Wraps the given onXXX callbacks into a Disposable CompletableObserver, adds it to the given CompositeDisposable and ensures, that if the upstream completes or this particlular Disposable is disposed, the CompletableObserver is removed from the given composite.

        The CompletableObserver will be removed after the callback for the terminal event has been invoked.

        Parameters:
        source - the source Completable to subscribe to.
        composite - the composite Disposable to add and remove the created Disposable CompletableObserver
        onComplete - the callback for when the upstream completes
        onError - the callback for an upstream error if any
        Returns:
        the Disposable that allows disposing the particular subscription.