public class Observers
extends java.lang.Object
Observer objects.| Constructor and Description |
|---|
Observers() |
| Modifier and Type | Method and Description |
|---|---|
static <T> Observer<T> |
create(Action1<? super T> onNext)
Creates an
Observer that receives the emissions of any Observable it subscribes to via
onNext but ignores onError and
onCompleted notifications. |
static <T> Observer<T> |
create(Action1<? super T> onNext,
Action1<java.lang.Throwable> onError)
Creates an
Observer that receives the emissions of any Observable it subscribes to via
onNext and handles any onError notification but ignores
an onCompleted notification. |
static <T> Observer<T> |
create(Action1<? super T> onNext,
Action1<java.lang.Throwable> onError,
Action0 onComplete)
Creates an
Observer that receives the emissions of any Observable it subscribes to via
onNext and handles any onError or
onCompleted notifications. |
static <T> Observer<T> |
empty()
Returns an inert
Observer that does nothing in response to the emissions or notifications from
any Observable it subscribes to. |
public static <T> Observer<T> empty()
Observer that does nothing in response to the emissions or notifications from
any Observable it subscribes to. This is different, however, from an EmptyObserver, in
that it will throw an exception if its onError method is called (whereas
EmptyObserver will swallow the error in such a case).Observerpublic static final <T> Observer<T> create(Action1<? super T> onNext)
Observer that receives the emissions of any Observable it subscribes to via
onNext but ignores onError and
onCompleted notifications.onNext - a function that handles each item emitted by an ObservableObserver that calls onNext for each emitted item from the Observable
the Observer subscribes toIllegalArgument - Exception
if onNext is nullpublic static final <T> Observer<T> create(Action1<? super T> onNext, Action1<java.lang.Throwable> onError)
Observer that receives the emissions of any Observable it subscribes to via
onNext and handles any onError notification but ignores
an onCompleted notification.onNext - a function that handles each item emitted by an ObservableonError - a function that handles an error notification if one is sent by an ObservableObserver that calls onNext for each emitted item from the Observable
the Observer subscribes to, and calls onError if the Observable notifies
of an errorIllegalArgument - Exception
if either onNext or onError are nullpublic static final <T> Observer<T> create(Action1<? super T> onNext, Action1<java.lang.Throwable> onError, Action0 onComplete)
Observer that receives the emissions of any Observable it subscribes to via
onNext and handles any onError or
onCompleted notifications.onNext - a function that handles each item emitted by an ObservableonError - a function that handles an error notification if one is sent by an ObservableonComplete - a function that handles a sequence complete notification if one is sent by an ObservableObserver that calls onNext for each emitted item from the Observable
the Observer subscribes to, calls onError if the Observable notifies
of an error, and calls onComplete if the Observable notifies that the observable
sequence is completeIllegalArgument - Exception
if either onNext, onError, or onComplete are null