Class 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 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: Perhaps
        Implement this method to react to a Subscriber subscribing to this Perhaps.
        Specified by:
        subscribeActual in class Perhaps<T>
        Parameters:
        s - the downstream Subscriber, never null
      • onError

        public void onError​(java.lang.Throwable t)
        Specified by:
        onError in interface Subscriber<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