Package hu.akarnokd.rxjava3.basetypes
Class PerhapsProcessor<T>
- java.lang.Object
-
- hu.akarnokd.rxjava3.basetypes.Perhaps<T>
-
- hu.akarnokd.rxjava3.basetypes.PerhapsProcessor<T>
-
- Type Parameters:
T- the input and output value type
- All Implemented Interfaces:
Processor<T,T>,Publisher<T>,Subscriber<T>
public final class PerhapsProcessor<T> extends Perhaps<T> implements Processor<T,T>
A Processor based on the Perhaps type that emits an onNext+onComplete, only onComplete or an onError.Calling the onNext multiple times has no effect.
- Since:
- 0.14.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> PerhapsProcessor<T>create()Creates a fresh PerhapsProcessor instance.java.lang.ThrowablegetThrowable()Returns the received onError Throwable if hasThrowable() is true, null otherwise.TgetValue()Returns the received onNext value if hasValue() is true, null otherwise.booleanhasComplete()Returns true if this PerhapsProcessor completed without any value.booleanhasSubscribers()Returns true if this Processor has Subscribers.booleanhasThrowable()Returns true if this PerhapsProcessor received an onError Throwable.booleanhasValue()Returns true if this PerhapsProcessor received an onNext value.voidonComplete()voidonError(java.lang.Throwable t)voidonNext(T t)voidonSubscribe(Subscription s)protected voidsubscribeActual(Subscriber<? super T> s)Implement this method to react to a Subscriber subscribing to this Perhaps.-
Methods inherited from class hu.akarnokd.rxjava3.basetypes.Perhaps
amb, ambArray, ambWith, andThen, andThen, blockingGet, blockingGet, blockingSubscribe, blockingSubscribe, blockingSubscribe, blockingSubscribe, cache, compose, concat, concat, concat, concatArray, concatArrayDelayError, concatDelayError, concatDelayError, concatDelayError, concatDelayError, concatWith, create, defaultIfEmpty, defer, delay, delay, delay, delaySubscription, delaySubscription, delaySubscription, doAfterNext, doAfterTerminate, doFinally, doOnCancel, doOnComplete, doOnError, doOnNext, doOnRequest, doOnSubscribe, empty, error, error, filter, flatMap, flatMap, flatMapPublisher, fromAction, fromCallable, fromCompletable, fromFuture, fromFuture, fromMaybe, fromPublisher, fromSingle, getOnAssemblyHandler, hide, ignoreElement, just, lift, map, mapError, merge, merge, merge, merge, mergeArray, mergeArray, mergeArrayDelayError, mergeArrayDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeWith, never, observeOn, onAssembly, onErrorComplete, onErrorResumeNext, onErrorResumeWith, onErrorReturnItem, repeat, repeat, repeat, repeatWhen, retry, retry, retry, retryWhen, setOnAssemblyHandler, subscribe, subscribe, subscribe, subscribe, subscribe, subscribeOn, subscribeWith, switchIfEmpty, takeUntil, test, test, test, test, timeout, timeout, timeout, timeout, timeout, timeout, timer, timer, to, toFlowable, toFuture, toMaybe, toObservable, unsubscribeOn, using, using, zip, zipArray, zipWith
-
-
-
-
Method Detail
-
create
public static <T> PerhapsProcessor<T> create()
Creates a fresh PerhapsProcessor instance.- Type Parameters:
T- the input and output value type- Returns:
- the new PerhapsProcessor instance
-
subscribeActual
protected void subscribeActual(Subscriber<? super T> s)
Description copied from class:PerhapsImplement this method to react to a Subscriber subscribing to this Perhaps.- Specified by:
subscribeActualin classPerhaps<T>- Parameters:
s- the downstream Subscriber, never null
-
onSubscribe
public void onSubscribe(Subscription s)
- Specified by:
onSubscribein interfaceSubscriber<T>
-
onNext
public void onNext(T t)
- Specified by:
onNextin interfaceSubscriber<T>
-
onError
public void onError(java.lang.Throwable t)
- Specified by:
onErrorin interfaceSubscriber<T>
-
onComplete
public void onComplete()
- Specified by:
onCompletein interfaceSubscriber<T>
-
hasSubscribers
public boolean hasSubscribers()
Returns true if this Processor has Subscribers.- Returns:
- true if this Processor has Subscribers
-
hasValue
public boolean hasValue()
Returns true if this PerhapsProcessor received an onNext value.- Returns:
- true if this PerhapsProcessor received an onNext value
-
getValue
public T getValue()
Returns the received onNext value if hasValue() is true, null otherwise.- Returns:
- the received onNext value if hasValue() is true, null otherwise
-
hasThrowable
public boolean hasThrowable()
Returns true if this PerhapsProcessor received an onError Throwable.- Returns:
- true if this PerhapsProcessor received an onError Throwable
-
getThrowable
public java.lang.Throwable getThrowable()
Returns the received onError Throwable if hasThrowable() is true, null otherwise.- Returns:
- the received onError Throwable if hasThrowable() is true, null otherwise
-
hasComplete
public boolean hasComplete()
Returns true if this PerhapsProcessor completed without any value.- Returns:
- true if this PerhapsProcessor completed without any value
-
-