T
- the value type received and emittedpublic final class MaybeSubject<T> extends Maybe<T> implements MaybeObserver<T>
All methods are thread safe. Calling onSuccess or onComplete multiple times has no effect. Calling onError multiple times relays the Throwable to the RxJavaPlugins' error handler.
The MaybeSubject doesn't store the Disposables coming through onSubscribe but disposes them once the other onXXX methods were called (terminal state reached).
Modifier and Type | Method and Description |
---|---|
static <T> MaybeSubject<T> |
create()
Creates a fresh MaybeSubject.
|
java.lang.Throwable |
getThrowable()
Returns the terminal error if this MaybeSubject has been terminated with an error, null otherwise.
|
T |
getValue()
Returns the success value if this MaybeSubject was terminated with a success value.
|
boolean |
hasComplete()
Returns true if this MaybeSubject has been completed.
|
boolean |
hasObservers()
Returns true if this MaybeSubject has observers.
|
boolean |
hasThrowable()
Returns true if this MaybeSubject has been terminated with an error.
|
boolean |
hasValue()
Returns true if this MaybeSubject was terminated with a success value.
|
void |
onComplete()
Called once the deferred computation completes normally.
|
void |
onError(java.lang.Throwable e)
Notifies the MaybeObserver that the
Maybe has experienced an error condition. |
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. |
void |
onSuccess(T value)
Notifies the MaybeObserver with one item and that the
Maybe has finished sending
push-based notifications. |
protected void |
subscribeActual(MaybeObserver<? super T> observer)
Override this method in subclasses to handle the incoming MaybeObservers.
|
amb, ambArray, ambWith, blockingGet, blockingGet, cache, cast, compose, concat, concat, concat, concat, concat, concat, concatArray, concatArrayDelayError, concatArrayEager, concatDelayError, concatDelayError, concatEager, concatEager, concatMap, concatWith, contains, count, create, defaultIfEmpty, defer, delay, delay, delay, delaySubscription, delaySubscription, delaySubscription, doAfterSuccess, doAfterTerminate, doFinally, doOnComplete, doOnDispose, doOnError, doOnEvent, doOnSubscribe, doOnSuccess, empty, error, error, filter, flatMap, flatMap, flatMap, flatMapCompletable, flatMapObservable, flatMapPublisher, flatMapSingle, flatMapSingleElement, flattenAsFlowable, flattenAsObservable, fromAction, fromCallable, fromCompletable, fromFuture, fromFuture, fromRunnable, fromSingle, hide, ignoreElement, isEmpty, just, lift, map, merge, merge, merge, merge, merge, merge, merge, mergeArray, mergeArrayDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeWith, never, observeOn, ofType, onErrorComplete, onErrorComplete, onErrorResumeNext, onErrorResumeNext, onErrorReturn, onErrorReturnItem, onExceptionResumeNext, onTerminateDetach, repeat, repeat, repeatUntil, repeatWhen, retry, retry, retry, retry, retry, retryUntil, retryWhen, sequenceEqual, sequenceEqual, subscribe, subscribe, subscribe, subscribe, subscribe, subscribeOn, subscribeWith, switchIfEmpty, takeUntil, takeUntil, test, test, timeout, timeout, timeout, timeout, timeout, timeout, timeout, timeout, timer, timer, to, toFlowable, toObservable, toSingle, toSingle, unsafeCreate, unsubscribeOn, using, using, wrap, zip, zip, zip, zip, zip, zip, zip, zip, zip, zipArray, zipWith
@CheckReturnValue public static <T> MaybeSubject<T> create()
T
- the value type received and emittedpublic void onSubscribe(Disposable d)
MaybeObserver
onSubscribe(Disposable)
itself) and asynchronous manner.onSubscribe
in interface MaybeObserver<T>
d
- the Disposable instance whose Disposable.dispose()
can
be called anytime to cancel the connectionpublic void onSuccess(T value)
MaybeObserver
Maybe
has finished sending
push-based notifications.
The Maybe
will not call this method if it calls MaybeObserver.onError(java.lang.Throwable)
.
onSuccess
in interface MaybeObserver<T>
value
- the item emitted by the Maybepublic void onError(java.lang.Throwable e)
MaybeObserver
Maybe
has experienced an error condition.
If the Maybe
calls this method, it will not thereafter call MaybeObserver.onSuccess(T)
.
onError
in interface MaybeObserver<T>
e
- the exception encountered by the Maybepublic void onComplete()
MaybeObserver
onComplete
in interface MaybeObserver<T>
protected void subscribeActual(MaybeObserver<? super T> observer)
Maybe
subscribeActual
in class Maybe<T>
observer
- the MaybeObserver to handle, not nullpublic T getValue()
public boolean hasValue()
public java.lang.Throwable getThrowable()
public boolean hasThrowable()
public boolean hasComplete()
public boolean hasObservers()