Enum Class NotificationLite
- All Implemented Interfaces:
Serializable
,Comparable<NotificationLite>
,Constable
Lightweight notification handling utility class.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class
Wraps a Disposable.(package private) static final class
Wraps a Throwable.(package private) static final class
Wraps a Subscription.Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> boolean
Calls the appropriate Observer method based on the type of the notification.static <T> boolean
Calls the appropriate Subscriber method based on the type of the notification.static <T> boolean
acceptFull
(Object o, Observer<? super T> observer) Calls the appropriate Observer method based on the type of the notification.static <T> boolean
acceptFull
(Object o, org.reactivestreams.Subscriber<? super T> s) Calls the appropriate Subscriber method based on the type of the notification.static Object
complete()
Returns a complete notification.static Object
Converts a Disposable into a notification value.static Object
Converts a Throwable into a notification value.static Disposable
static Throwable
Extracts the Throwable from the notification object.static org.reactivestreams.Subscription
Extracts the Subscription from the notification object.static <T> T
Extracts the value from the notification object.static boolean
isComplete
(Object o) Checks if the given object represents a complete notification.static boolean
static boolean
Checks if the given object represents a error notification.static boolean
Checks if the given object represents a subscription notification.static <T> Object
next
(T value) Converts a value into a notification value.static Object
subscription
(org.reactivestreams.Subscription s) Converts a Subscription into a notification value.toString()
static NotificationLite
Returns the enum constant of this class with the specified name.static NotificationLite[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
COMPLETE
-
-
Constructor Details
-
NotificationLite
private NotificationLite()
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
next
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
Returns a complete notification.- Returns:
- a complete notification
-
error
Converts a Throwable into a notification value.- Parameters:
e
- the Throwable to convert- Returns:
- the notification representing the Throwable
-
subscription
Converts a Subscription into a notification value.- Parameters:
s
- the Subscription to convert- Returns:
- the notification representing the Subscription
-
disposable
Converts a Disposable into a notification value.- Parameters:
d
- the disposable to convert- Returns:
- the notification representing the Disposable
-
isComplete
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
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
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
-
getValue
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
Extracts the Throwable from the notification object.- Parameters:
o
- the notification object- Returns:
- the extracted Throwable
-
getSubscription
Extracts the Subscription from the notification object.- Parameters:
o
- the notification object- Returns:
- the extracted Subscription
-
getDisposable
-
accept
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 objects
- the subscriber to call methods on- Returns:
- true if the notification was a terminal event (i.e., complete or error)
- See Also:
-
accept
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 objectobserver
- the Observer to call methods on- Returns:
- true if the notification was a terminal event (i.e., complete or error)
-
acceptFull
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 objects
- the subscriber to call methods on- Returns:
- true if the notification was a terminal event (i.e., complete or error)
- See Also:
-
acceptFull
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 objectobserver
- the subscriber to call methods on- Returns:
- true if the notification was a terminal event (i.e., complete or error)
- See Also:
-
toString
- Overrides:
toString
in classEnum<NotificationLite>
-