Package 

Class Observers


  • 
    public final class Observers
    
                        

    Helper methods and utilities for creating and working with Observer objects.

    • Method Detail

      • empty

         static <T> Observer<T> empty()

        Returns an inert Observer that does nothing in response to the emissions or notifications fromany {@code Observable} it subscribes to but will throw an exception if its onError method is called.

      • create

         static <T> Observer<T> create(Action1<out Object> onNext, Action1<Throwable> onError)

        Creates an Observer that receives the emissions of any {@code Observable} it subscribes to via onNext and handles any onError notification but ignoresan onCompleted notification.

        Parameters:
        onNext - a function that handles each item emitted by an {@code Observable}
        onError - a function that handles an error notification if one is sent by an {@code Observable}
      • create

         static <T> Observer<T> create(Action1<out Object> onNext, Action1<Throwable> onError, Action0 onComplete)

        Creates an Observer that receives the emissions of any {@code Observable} it subscribes to via onNext and handles any onError or onCompleted notifications.

        Parameters:
        onNext - a function that handles each item emitted by an {@code Observable}
        onError - a function that handles an error notification if one is sent by an {@code Observable}
        onComplete - a function that handles a sequence complete notification if one is sent by an {@code Observable}