Top Description Methods
io.reactivex

public Interface MaybeObserver<T>

Known Direct Implementers
io.reactivex.internal.observers.BlockingMultiObserver, io.reactivex.internal.operators.flowable.FlowableConcatWithMaybe.ConcatWithSubscriber, io.reactivex.internal.operators.flowable.FlowableFlatMapMaybe.FlatMapMaybeSubscriber.InnerObserver, io.reactivex.internal.operators.flowable.FlowableMergeWithMaybe.MergeWithObserver.OtherObserver, io.reactivex.internal.operators.maybe.MaybeAmb.AmbMaybeObserver, io.reactivex.internal.operators.maybe.MaybeCache, io.reactivex.internal.operators.maybe.MaybeCallbackObserver, io.reactivex.internal.operators.maybe.MaybeConcatArray.ConcatMaybeObserver, io.reactivex.internal.operators.maybe.MaybeConcatArrayDelayError.ConcatMaybeObserver, io.reactivex.internal.operators.maybe.MaybeConcatIterable.ConcatMaybeObserver, io.reactivex.internal.operators.maybe.MaybeContains.ContainsMaybeObserver, io.reactivex.internal.operators.maybe.MaybeCount.CountMaybeObserver, io.reactivex.internal.operators.maybe.MaybeDelay.DelayMaybeObserver, io.reactivex.internal.operators.maybe.MaybeDelayOtherPublisher.DelayMaybeObserver, io.reactivex.internal.operators.maybe.MaybeDelaySubscriptionOtherPublisher.DelayMaybeObserver, io.reactivex.internal.operators.maybe.MaybeDelayWithCompletable.DelayWithMainObserver, io.reactivex.internal.operators.maybe.MaybeDetach.DetachMaybeObserver, io.reactivex.internal.operators.maybe.MaybeDoAfterSuccess.DoAfterObserver, io.reactivex.internal.operators.maybe.MaybeHide.HideMaybeObserver, io.reactivex.internal.operators.maybe.MaybeIgnoreElement.IgnoreMaybeObserver, io.reactivex.internal.operators.maybe.MaybeIgnoreElementCompletable.IgnoreMaybeObserver, io.reactivex.internal.operators.maybe.MaybeIsEmpty.IsEmptyMaybeObserver, io.reactivex.internal.operators.maybe.MaybeIsEmptySingle.IsEmptyMaybeObserver, io.reactivex.internal.operators.maybe.MaybeMap.MapMaybeObserver, io.reactivex.internal.operators.maybe.MaybeMergeArray.MergeMaybeObserver, io.reactivex.internal.operators.maybe.MaybeObserveOn.ObserveOnMaybeObserver, io.reactivex.internal.operators.maybe.MaybeOnErrorComplete.OnErrorCompleteMaybeObserver, io.reactivex.internal.operators.maybe.MaybeOnErrorNext.OnErrorNextMaybeObserver, io.reactivex.internal.operators.maybe.MaybeOnErrorNext.OnErrorNextMaybeObserver.NextMaybeObserver, io.reactivex.internal.operators.maybe.MaybeOnErrorReturn.OnErrorReturnMaybeObserver, io.reactivex.internal.operators.maybe.MaybePeek.MaybePeekObserver, io.reactivex.internal.operators.maybe.MaybeDoOnEvent.DoOnEventMaybeObserver, io.reactivex.internal.operators.maybe.MaybeDoOnTerminate.DoOnTerminate, io.reactivex.internal.operators.maybe.MaybeEqualSingle.EqualObserver, io.reactivex.internal.operators.maybe.MaybeFilter.FilterMaybeObserver, io.reactivex.internal.operators.maybe.MaybeFlatMapBiSelector.FlatMapBiMainObserver, io.reactivex.internal.operators.maybe.MaybeFlatMapBiSelector.FlatMapBiMainObserver.InnerObserver, io.reactivex.internal.operators.maybe.MaybeFlatMapCompletable.FlatMapCompletableObserver, io.reactivex.internal.operators.maybe.MaybeFlatMapIterableFlowable.FlatMapIterableObserver, io.reactivex.internal.operators.maybe.MaybeFlatMapIterableObservable.FlatMapIterableObserver, io.reactivex.internal.operators.maybe.MaybeFlatMapNotification.FlatMapMaybeObserver, io.reactivex.internal.operators.maybe.MaybeFlatMapNotification.FlatMapMaybeObserver.InnerObserver, io.reactivex.internal.operators.maybe.MaybeFlatMapSingle.FlatMapMaybeObserver, io.reactivex.internal.operators.maybe.MaybeFlatMapSingleElement.FlatMapMaybeObserver, io.reactivex.internal.operators.maybe.MaybeFlatten.FlatMapMaybeObserver, io.reactivex.internal.operators.maybe.MaybeFlatten.FlatMapMaybeObserver.InnerObserver, io.reactivex.internal.operators.maybe.MaybeSwitchIfEmpty.SwitchIfEmptyMaybeObserver, io.reactivex.internal.operators.maybe.MaybeSwitchIfEmpty.SwitchIfEmptyMaybeObserver.OtherMaybeObserver, io.reactivex.internal.operators.maybe.MaybeSwitchIfEmptySingle.SwitchIfEmptyMaybeObserver, io.reactivex.internal.operators.maybe.MaybeTakeUntilMaybe.TakeUntilMainMaybeObserver, io.reactivex.internal.operators.maybe.MaybeTakeUntilMaybe.TakeUntilMainMaybeObserver.TakeUntilOtherMaybeObserver, io.reactivex.internal.operators.maybe.MaybeTakeUntilPublisher.TakeUntilMainMaybeObserver, io.reactivex.internal.operators.maybe.MaybeTimeoutMaybe.TimeoutMainMaybeObserver, io.reactivex.internal.operators.maybe.MaybeTimeoutMaybe.TimeoutOtherMaybeObserver, io.reactivex.internal.operators.maybe.MaybeTimeoutMaybe.TimeoutFallbackMaybeObserver, io.reactivex.internal.operators.maybe.MaybeTimeoutPublisher.TimeoutMainMaybeObserver, io.reactivex.internal.operators.maybe.MaybeTimeoutPublisher.TimeoutFallbackMaybeObserver, io.reactivex.internal.operators.maybe.MaybeToFlowable.MaybeToFlowableSubscriber, io.reactivex.internal.operators.maybe.MaybeToObservable.MaybeToObservableObserver, io.reactivex.internal.operators.maybe.MaybeToSingle.ToSingleMaybeSubscriber, io.reactivex.internal.operators.maybe.MaybeUnsubscribeOn.UnsubscribeOnMaybeObserver, io.reactivex.internal.operators.maybe.MaybeUsing.UsingObserver, io.reactivex.internal.operators.maybe.MaybeZipArray.ZipMaybeObserver, io.reactivex.internal.operators.maybe.MaybeDoFinally.DoFinallyObserver, io.reactivex.internal.operators.maybe.MaybeSubscribeOn.SubscribeOnMaybeObserver, io.reactivex.internal.operators.mixed.FlowableConcatMapMaybe.ConcatMapMaybeSubscriber.ConcatMapMaybeObserver, io.reactivex.internal.operators.mixed.FlowableSwitchMapMaybe.SwitchMapMaybeSubscriber.SwitchMapMaybeObserver, io.reactivex.internal.operators.mixed.MaterializeSingleObserver, io.reactivex.internal.operators.mixed.MaybeFlatMapObservable.FlatMapObserver, io.reactivex.internal.operators.mixed.MaybeFlatMapPublisher.FlatMapPublisherSubscriber, io.reactivex.internal.operators.mixed.ObservableConcatMapMaybe.ConcatMapMaybeMainObserver.ConcatMapMaybeObserver, io.reactivex.internal.operators.mixed.ObservableSwitchMapMaybe.SwitchMapMaybeMainObserver.SwitchMapMaybeObserver, io.reactivex.internal.operators.observable.ObservableFlatMapMaybe.FlatMapMaybeObserver.InnerObserver, io.reactivex.internal.operators.observable.ObservableConcatWithMaybe.ConcatWithObserver, io.reactivex.internal.operators.observable.ObservableMergeWithMaybe.MergeWithObserver.OtherObserver, io.reactivex.internal.operators.single.SingleFlatMapMaybe.FlatMapMaybeObserver, io.reactivex.internal.util.EmptyComponent, io.reactivex.observers.DisposableMaybeObserver, io.reactivex.observers.ResourceMaybeObserver, io.reactivex.observers.TestObserver, io.reactivex.subjects.MaybeSubject
Type Parameters
<T>
the type of item the MaybeObserver expects to observe
Imports
io.reactivex.annotations.*, io.reactivex.disposables.Disposable

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

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

Calling the MaybeObserver'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 | onComplete)?

Note that unlike with the Observable protocol, onComplete() is not called after the success item has been signalled via onSuccess(Object).

Subscribing a MaybeObserver to multiple MaybeSources is not recommended. If such reuse happens, it is the duty of the MaybeObserver 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
onComplete()

Called once the deferred computation completes normally.

public void
onError(Throwable
the exception encountered by the Maybe
e
)

Notifies the MaybeObserver that the Maybe 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 MaybeObserver with the means of cancelling (disposing) the connection (channel) with the Maybe in both synchronous (from within onSubscribe(Disposable) itself) and asynchronous manner.

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

Notifies the MaybeObserver with one item and that the Maybe has finished sending push-based notifications.

Method Detail

onCompleteback to summary
public void onComplete()

Called once the deferred computation completes normally.

onErrorback to summary
public void onError(Throwable e)

Notifies the MaybeObserver that the Maybe has experienced an error condition.

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

Parameters
e:Throwable

the exception encountered by the Maybe

onSubscribeback to summary
public void onSubscribe(Disposable d)

Provides the MaybeObserver with the means of cancelling (disposing) the connection (channel) with the Maybe 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

onSuccessback to summary
public void onSuccess(T t)

Notifies the MaybeObserver with one item and that the Maybe has finished sending push-based notifications.

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

Parameters
t:T

the item emitted by the Maybe