Class Subject<T>

    • Constructor Detail

      • Subject

        public Subject()
    • Method Detail

      • hasObservers

        @CheckReturnValue
        public abstract boolean hasObservers()
        Returns true if the subject has any Observers.

        The method is thread-safe.

        Returns:
        true if the subject has any Observers
      • hasThrowable

        @CheckReturnValue
        public abstract boolean hasThrowable()
        Returns true if the subject has reached a terminal state through an error event.

        The method is thread-safe.

        Returns:
        true if the subject has reached a terminal state through an error event
        See Also:
        getThrowable(), hasComplete()
      • hasComplete

        @CheckReturnValue
        public abstract boolean hasComplete()
        Returns true if the subject has reached a terminal state through a complete event.

        The method is thread-safe.

        Returns:
        true if the subject has reached a terminal state through a complete event
        See Also:
        hasThrowable()
      • getThrowable

        @Nullable
        @CheckReturnValue
        public abstract @Nullable java.lang.Throwable getThrowable()
        Returns the error that caused the Subject to terminate or null if the Subject hasn't terminated yet.

        The method is thread-safe.

        Returns:
        the error that caused the Subject to terminate or null if the Subject hasn't terminated yet
      • toSerialized

        @NonNull
        @CheckReturnValue
        public final @NonNull Subject<T> toSerialized()
        Wraps this Subject and serializes the calls to the onSubscribe, onNext, onError and onComplete methods, making them thread-safe.

        The method is thread-safe.

        Returns:
        the wrapped and serialized subject