Package io.reactivex.rxjava3.core
Class Notification<T>
java.lang.Object
io.reactivex.rxjava3.core.Notification<T>
- Type Parameters:
T
- the value type
Represents the reactive signal types:
onNext
, onError
and onComplete
and
holds their parameter values (a value, a Throwable
, nothing).-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final Notification
<Object> The singleton instance for createOnComplete.(package private) final Object
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Notification
(@Nullable Object value) Not meant to be implemented externally. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> @NonNull Notification
<T> Returns the empty and stateless shared instance of a notification representing anonComplete
signal.static <T> @NonNull Notification
<T> createOnError
(@NonNull Throwable error) Constructs an onError notification containing the error.static <@NonNull T>
@NonNull Notification<T> createOnNext
(@NonNull T value) Constructs an onNext notification containing the given value.boolean
getError()
Returns the containerThrowable
error if this notification is anonError
signal, null otherwise.getValue()
Returns the contained value if this notification is anonNext
signal, null otherwise.int
hashCode()
boolean
Returns true if this notification is anonComplete
signal.boolean
Returns true if this notification is anonError
signal andgetError()
returns the containedThrowable
.boolean
isOnNext()
Returns true if this notification is anonNext
signal andgetValue()
returns the contained value.toString()
-
Field Details
-
value
-
COMPLETE
The singleton instance for createOnComplete.
-
-
Constructor Details
-
Notification
Not meant to be implemented externally.- Parameters:
value
- the value to carry around in the notification, notnull
-
-
Method Details
-
isOnComplete
public boolean isOnComplete()Returns true if this notification is anonComplete
signal.- Returns:
- true if this notification is an
onComplete
signal
-
isOnError
public boolean isOnError()Returns true if this notification is anonError
signal andgetError()
returns the containedThrowable
.- Returns:
- true if this notification is an
onError
signal - See Also:
-
isOnNext
public boolean isOnNext()Returns true if this notification is anonNext
signal andgetValue()
returns the contained value.- Returns:
- true if this notification is an
onNext
signal - See Also:
-
getValue
Returns the contained value if this notification is anonNext
signal, null otherwise.- Returns:
- the value contained or null
- See Also:
-
getError
Returns the containerThrowable
error if this notification is anonError
signal, null otherwise.- Returns:
- the
Throwable
error contained ornull
- See Also:
-
equals
-
hashCode
public int hashCode() -
toString
-
createOnNext
Constructs an onNext notification containing the given value.- Type Parameters:
T
- the value type- Parameters:
value
- the value to carry around in the notification, notnull
- Returns:
- the new Notification instance
- Throws:
NullPointerException
- if value isnull
-
createOnError
@NonNull public static <T> @NonNull Notification<T> createOnError(@NonNull @NonNull Throwable error) Constructs an onError notification containing the error.- Type Parameters:
T
- the value type- Parameters:
error
- the error Throwable to carry around in the notification, not null- Returns:
- the new Notification instance
- Throws:
NullPointerException
- if error isnull
-
createOnComplete
Returns the empty and stateless shared instance of a notification representing anonComplete
signal.- Type Parameters:
T
- the target value type- Returns:
- the shared Notification instance representing an
onComplete
signal
-