T - the type of item the Observer expects to observepublic interface Observer<T>
After an Observer calls an Observable's subscribe method,
first the Observable calls onSubscribe(Disposable) with a Disposable that allows
cancelling the sequence at any time, then the
Observable may call the Observer's onNext(T) method any number of times
to provide notifications. A well-behaved
Observable will call an Observer's onComplete() method exactly once or the Observer's
onError(java.lang.Throwable) method exactly once.
| Modifier and Type | Method and Description |
|---|---|
void |
onComplete()
Notifies the Observer that the
Observable has finished sending push-based notifications. |
void |
onError(java.lang.Throwable e)
Notifies the Observer that the
Observable has experienced an error condition. |
void |
onNext(T t)
Provides the Observer with a new item to observe.
|
void |
onSubscribe(Disposable d)
Provides the Observer with the means of cancelling (disposing) the
connection (channel) with the Observable in both
synchronous (from within
onNext(Object)) and asynchronous manner. |
void onSubscribe(Disposable d)
onNext(Object)) and asynchronous manner.d - the Disposable instance whose Disposable.dispose() can
be called anytime to cancel the connectionvoid onNext(T t)
The Observable may call this method 0 or more times.
The Observable will not call this method again after it calls either onComplete() or
onError(java.lang.Throwable).
t - the item emitted by the Observablevoid onError(java.lang.Throwable e)
Observable has experienced an error condition.
If the Observable calls this method, it will not thereafter call onNext(T) or
onComplete().
e - the exception encountered by the Observablevoid onComplete()
Observable has finished sending push-based notifications.
The Observable will not call this method if it calls onError(java.lang.Throwable).