Enum NotificationLite

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<NotificationLite>

    public enum NotificationLite
    extends java.lang.Enum<NotificationLite>
    Lightweight notification handling utility class.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      COMPLETE  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private NotificationLite()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> boolean accept​(java.lang.Object o, Observer<? super T> observer)
      Calls the appropriate Observer method based on the type of the notification.
      static <T> boolean accept​(java.lang.Object o, org.reactivestreams.Subscriber<? super T> s)
      Calls the appropriate Subscriber method based on the type of the notification.
      static <T> boolean acceptFull​(java.lang.Object o, Observer<? super T> observer)
      Calls the appropriate Observer method based on the type of the notification.
      static <T> boolean acceptFull​(java.lang.Object o, org.reactivestreams.Subscriber<? super T> s)
      Calls the appropriate Subscriber method based on the type of the notification.
      static java.lang.Object complete()
      Returns a complete notification.
      static java.lang.Object disposable​(Disposable d)
      Converts a Disposable into a notification value.
      static java.lang.Object error​(java.lang.Throwable e)
      Converts a Throwable into a notification value.
      static Disposable getDisposable​(java.lang.Object o)  
      static java.lang.Throwable getError​(java.lang.Object o)
      Extracts the Throwable from the notification object.
      static org.reactivestreams.Subscription getSubscription​(java.lang.Object o)
      Extracts the Subscription from the notification object.
      static <T> T getValue​(java.lang.Object o)
      Extracts the value from the notification object.
      static boolean isComplete​(java.lang.Object o)
      Checks if the given object represents a complete notification.
      static boolean isDisposable​(java.lang.Object o)  
      static boolean isError​(java.lang.Object o)
      Checks if the given object represents a error notification.
      static boolean isSubscription​(java.lang.Object o)
      Checks if the given object represents a subscription notification.
      static <T> java.lang.Object next​(T value)
      Converts a value into a notification value.
      static java.lang.Object subscription​(org.reactivestreams.Subscription s)
      Converts a Subscription into a notification value.
      java.lang.String toString()  
      static NotificationLite valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static NotificationLite[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • NotificationLite

        private NotificationLite()
    • Method Detail

      • values

        public static NotificationLite[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (NotificationLite c : NotificationLite.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static NotificationLite valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • next

        public static <T> java.lang.Object next​(T value)
        Converts a value into a notification value.
        Type Parameters:
        T - the actual value type
        Parameters:
        value - the value to convert
        Returns:
        the notification representing the value
      • complete

        public static java.lang.Object complete()
        Returns a complete notification.
        Returns:
        a complete notification
      • error

        public static java.lang.Object error​(java.lang.Throwable e)
        Converts a Throwable into a notification value.
        Parameters:
        e - the Throwable to convert
        Returns:
        the notification representing the Throwable
      • subscription

        public static java.lang.Object subscription​(org.reactivestreams.Subscription s)
        Converts a Subscription into a notification value.
        Parameters:
        s - the Subscription to convert
        Returns:
        the notification representing the Subscription
      • disposable

        public static java.lang.Object disposable​(Disposable d)
        Converts a Disposable into a notification value.
        Parameters:
        d - the disposable to convert
        Returns:
        the notification representing the Disposable
      • isComplete

        public static boolean isComplete​(java.lang.Object o)
        Checks if the given object represents a complete notification.
        Parameters:
        o - the object to check
        Returns:
        true if the object represents a complete notification
      • isError

        public static boolean isError​(java.lang.Object o)
        Checks if the given object represents a error notification.
        Parameters:
        o - the object to check
        Returns:
        true if the object represents a error notification
      • isSubscription

        public static boolean isSubscription​(java.lang.Object o)
        Checks if the given object represents a subscription notification.
        Parameters:
        o - the object to check
        Returns:
        true if the object represents a subscription notification
      • isDisposable

        public static boolean isDisposable​(java.lang.Object o)
      • getValue

        public static <T> T getValue​(java.lang.Object o)
        Extracts the value from the notification object.
        Type Parameters:
        T - the expected value type when unwrapped
        Parameters:
        o - the notification object
        Returns:
        the extracted value
      • getError

        public static java.lang.Throwable getError​(java.lang.Object o)
        Extracts the Throwable from the notification object.
        Parameters:
        o - the notification object
        Returns:
        the extracted Throwable
      • getSubscription

        public static org.reactivestreams.Subscription getSubscription​(java.lang.Object o)
        Extracts the Subscription from the notification object.
        Parameters:
        o - the notification object
        Returns:
        the extracted Subscription
      • getDisposable

        public static Disposable getDisposable​(java.lang.Object o)
      • accept

        public static <T> boolean accept​(java.lang.Object o,
                                         org.reactivestreams.Subscriber<? super T> s)
        Calls the appropriate Subscriber method based on the type of the notification.

        Does not check for a subscription notification, see acceptFull(Object, Subscriber).

        Type Parameters:
        T - the expected value type when unwrapped
        Parameters:
        o - the notification object
        s - the subscriber to call methods on
        Returns:
        true if the notification was a terminal event (i.e., complete or error)
        See Also:
        acceptFull(Object, Subscriber)
      • accept

        public static <T> boolean accept​(java.lang.Object o,
                                         Observer<? super T> observer)
        Calls the appropriate Observer method based on the type of the notification.

        Does not check for a subscription notification.

        Type Parameters:
        T - the expected value type when unwrapped
        Parameters:
        o - the notification object
        observer - the Observer to call methods on
        Returns:
        true if the notification was a terminal event (i.e., complete or error)
      • acceptFull

        public static <T> boolean acceptFull​(java.lang.Object o,
                                             org.reactivestreams.Subscriber<? super T> s)
        Calls the appropriate Subscriber method based on the type of the notification.
        Type Parameters:
        T - the expected value type when unwrapped
        Parameters:
        o - the notification object
        s - the subscriber to call methods on
        Returns:
        true if the notification was a terminal event (i.e., complete or error)
        See Also:
        accept(Object, Subscriber)
      • acceptFull

        public static <T> boolean acceptFull​(java.lang.Object o,
                                             Observer<? super T> observer)
        Calls the appropriate Observer method based on the type of the notification.
        Type Parameters:
        T - the expected value type when unwrapped
        Parameters:
        o - the notification object
        observer - the subscriber to call methods on
        Returns:
        true if the notification was a terminal event (i.e., complete or error)
        See Also:
        accept(Object, Observer)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Enum<NotificationLite>