Top Description Methods
io.reactivex

public Interface SingleObserver<T>

Known Direct Implementers
io.reactivex.internal.observers.BiConsumerSingleObserver, io.reactivex.internal.observers.BlockingMultiObserver, io.reactivex.internal.observers.ConsumerSingleObserver, io.reactivex.internal.observers.FutureSingleObserver, io.reactivex.internal.observers.ResumeSingleObserver, io.reactivex.internal.operators.completable.CompletableFromSingle.CompletableFromSingleObserver, io.reactivex.internal.operators.flowable.FlowableConcatWithSingle.ConcatWithSubscriber, io.reactivex.internal.operators.flowable.FlowableFlatMapSingle.FlatMapSingleSubscriber.InnerObserver, io.reactivex.internal.operators.flowable.FlowableMergeWithSingle.MergeWithObserver.OtherObserver, io.reactivex.internal.operators.maybe.MaybeFromSingle.FromSingleObserver, io.reactivex.internal.operators.maybe.MaybeFilterSingle.FilterMaybeObserver, io.reactivex.internal.operators.maybe.MaybeFlatMapSingle.FlatMapSingleObserver, io.reactivex.internal.operators.maybe.MaybeFlatMapSingleElement.FlatMapSingleObserver, io.reactivex.internal.operators.maybe.MaybeSwitchIfEmptySingle.SwitchIfEmptyMaybeObserver.OtherSingleObserver, io.reactivex.internal.operators.mixed.FlowableConcatMapSingle.ConcatMapSingleSubscriber.ConcatMapSingleObserver, io.reactivex.internal.operators.mixed.FlowableSwitchMapSingle.SwitchMapSingleSubscriber.SwitchMapSingleObserver, io.reactivex.internal.operators.mixed.MaterializeSingleObserver, io.reactivex.internal.operators.mixed.ObservableConcatMapSingle.ConcatMapSingleMainObserver.ConcatMapSingleObserver, io.reactivex.internal.operators.mixed.ObservableSwitchMapSingle.SwitchMapSingleMainObserver.SwitchMapSingleObserver, io.reactivex.internal.operators.mixed.SingleFlatMapObservable.FlatMapObserver, io.reactivex.internal.operators.observable.ObservableFlatMapSingle.FlatMapSingleObserver.InnerObserver, io.reactivex.internal.operators.observable.ObservableConcatWithSingle.ConcatWithObserver, io.reactivex.internal.operators.observable.ObservableMergeWithSingle.MergeWithObserver.OtherObserver, io.reactivex.internal.operators.single.SingleFlatMapIterableObservable.FlatMapIterableObserver, io.reactivex.internal.operators.single.SingleAmb.AmbSingleObserver, io.reactivex.internal.operators.single.SingleCache, io.reactivex.internal.operators.single.SingleContains.ContainsSingleObserver, io.reactivex.internal.operators.single.SingleDelay.Delay, io.reactivex.internal.operators.single.SingleDelayWithSingle.OtherObserver, io.reactivex.internal.operators.single.SingleDematerialize.DematerializeObserver, io.reactivex.internal.operators.single.SingleDetach.DetachSingleObserver, io.reactivex.internal.operators.single.SingleDoAfterSuccess.DoAfterObserver, io.reactivex.internal.operators.single.SingleDoAfterTerminate.DoAfterTerminateObserver, io.reactivex.internal.operators.single.SingleDoFinally.DoFinallyObserver, io.reactivex.internal.operators.single.SingleDoOnDispose.DoOnDisposeObserver, io.reactivex.internal.operators.single.SingleDoOnError.DoOnError, io.reactivex.internal.operators.single.SingleDoOnEvent.DoOnEvent, io.reactivex.internal.operators.single.SingleDoOnSubscribe.DoOnSubscribeSingleObserver, io.reactivex.internal.operators.single.SingleDoOnSuccess.DoOnSuccess, io.reactivex.internal.operators.single.SingleDoOnTerminate.DoOnTerminate, io.reactivex.internal.operators.single.SingleEquals.InnerObserver, io.reactivex.internal.operators.single.SingleFlatMap.SingleFlatMapCallback, io.reactivex.internal.operators.single.SingleFlatMap.SingleFlatMapCallback.FlatMapSingleObserver, io.reactivex.internal.operators.single.SingleFlatMapCompletable.FlatMapCompletableObserver, io.reactivex.internal.operators.single.SingleFlatMapIterableFlowable.FlatMapIterableObserver, io.reactivex.internal.operators.single.SingleFlatMapMaybe.FlatMapSingleObserver, io.reactivex.internal.operators.single.SingleFlatMapPublisher.SingleFlatMapPublisherObserver, io.reactivex.internal.operators.single.SingleHide.HideSingleObserver, io.reactivex.internal.operators.single.SingleMap.MapSingleObserver, io.reactivex.internal.operators.single.SingleObserveOn.ObserveOnSingleObserver, io.reactivex.internal.operators.single.SingleOnErrorReturn.OnErrorReturn, io.reactivex.internal.operators.single.SingleResumeNext.ResumeMainSingleObserver, io.reactivex.internal.operators.single.SingleSubscribeOn.SubscribeOnObserver, io.reactivex.internal.operators.single.SingleTakeUntil.TakeUntilMainObserver, io.reactivex.internal.operators.single.SingleTimeout.TimeoutMainObserver, io.reactivex.internal.operators.single.SingleTimeout.TimeoutMainObserver.TimeoutFallbackObserver, io.reactivex.internal.operators.single.SingleToFlowable.SingleToFlowableObserver, io.reactivex.internal.operators.single.SingleToObservable.SingleToObservableObserver, io.reactivex.internal.operators.single.SingleUnsubscribeOn.UnsubscribeOnSingleObserver, io.reactivex.internal.operators.single.SingleUsing.UsingSingleObserver, io.reactivex.internal.operators.single.SingleZipArray.ZipSingleObserver, io.reactivex.internal.util.EmptyComponent, io.reactivex.observers.DisposableSingleObserver, io.reactivex.observers.ResourceSingleObserver, io.reactivex.observers.TestObserver, io.reactivex.subjects.SingleSubject
Type Parameters
<T>
the type of item the SingleObserver expects to observe
Imports
io.reactivex.annotations.*, io.reactivex.disposables.Disposable

Provides a mechanism for receiving push-based notification of a single value or an error.

When a SingleObserver is subscribed to a SingleSource through the SingleSource#subscribe(SingleObserver) method, the SingleSource calls onSubscribe(Disposable) with a Disposable that allows disposing the sequence at any time. A well-behaved SingleSource will call a SingleObserver's onSuccess(Object) method exactly once or the SingleObserver's onError method exactly once as they are considered mutually exclusive terminal signals.

Calling the SingleObserver's method must happen in a serialized fashion, that is, they must not be invoked concurrently by multiple threads in an overlapping fashion and the invocation pattern must adhere to the following protocol:

    onSubscribe (onSuccess | onError)?

Subscribing a SingleObserver to multiple SingleSources is not recommended. If such reuse happens, it is the duty of the SingleObserver implementation to be ready to receive multiple calls to its methods and ensure proper concurrent behavior of its business logic.

Calling onSubscribe(Disposable), onSuccess(Object) or onError(Throwable) with a null argument is forbidden.

The implementations of the onXXX methods should avoid throwing runtime exceptions other than the following cases:

Since
2.0
See Also
ReactiveX documentation: Observable

Method Summary

Modifier and TypeMethod and Description
public void
onError(Throwable
the exception encountered by the Single
e
)

Notifies the SingleObserver that the Single has experienced an error condition.

public void
onSubscribe(Disposable
the Disposable instance whose Disposable#dispose() can be called anytime to cancel the connection
d
)

Provides the SingleObserver with the means of cancelling (disposing) the connection (channel) with the Single in both synchronous (from within onSubscribe(Disposable) itself) and asynchronous manner.

public void
onSuccess(T
the item emitted by the Single
t
)

Notifies the SingleObserver with a single item and that the Single has finished sending push-based notifications.

Method Detail

onErrorback to summary
public void onError(Throwable e)

Notifies the SingleObserver that the Single has experienced an error condition.

If the Single calls this method, it will not thereafter call onSuccess.

Parameters
e:Throwable

the exception encountered by the Single

onSubscribeback to summary
public void onSubscribe(Disposable d)

Provides the SingleObserver with the means of cancelling (disposing) the connection (channel) with the Single in both synchronous (from within onSubscribe(Disposable) itself) and asynchronous manner.

Parameters
d:Disposable

the Disposable instance whose Disposable#dispose() can be called anytime to cancel the connection

Since
2.0
onSuccessback to summary
public void onSuccess(T t)

Notifies the SingleObserver with a single item and that the Single has finished sending push-based notifications.

The Single will not call this method if it calls onError.

Parameters
t:T

the item emitted by the Single