T
- the value typepublic final class Notification<T>
extends java.lang.Object
onNext
, onError
and onComplete
and
holds their parameter values (a value, a Throwable
, nothing).Modifier and Type | Method and Description |
---|---|
static <T> @NonNull Notification<T> |
createOnComplete()
Returns the empty and stateless shared instance of a notification representing
an
onComplete signal. |
static <T> @NonNull Notification<T> |
createOnError(@NonNull java.lang.Throwable error)
Constructs an onError notification containing the error.
|
static <T> @NonNull Notification<T> |
createOnNext(T value)
Constructs an onNext notification containing the given value.
|
boolean |
equals(java.lang.Object obj) |
@Nullable java.lang.Throwable |
getError()
Returns the container
Throwable error if this notification is an onError
signal, null otherwise. |
T |
getValue()
Returns the contained value if this notification is an
onNext
signal, null otherwise. |
int |
hashCode() |
boolean |
isOnComplete()
Returns true if this notification is an
onComplete signal. |
boolean |
isOnError()
Returns true if this notification is an
onError signal and
getError() returns the contained Throwable . |
boolean |
isOnNext()
Returns true if this notification is an
onNext signal and
getValue() returns the contained value. |
java.lang.String |
toString() |
public boolean isOnComplete()
onComplete
signal.onComplete
signalpublic boolean isOnError()
onError
signal and
getError()
returns the contained Throwable
.onError
signalgetError()
public boolean isOnNext()
onNext
signal and
getValue()
returns the contained value.onNext
signalgetValue()
@Nullable public T getValue()
onNext
signal, null otherwise.isOnNext()
@Nullable public @Nullable java.lang.Throwable getError()
Throwable
error if this notification is an onError
signal, null otherwise.Throwable
error contained or null
isOnError()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
@NonNull public static <T> @NonNull Notification<T> createOnNext(T value)
T
- the value typevalue
- the value to carry around in the notification, not null
java.lang.NullPointerException
- if value is null
@NonNull public static <T> @NonNull Notification<T> createOnError(@NonNull @NonNull java.lang.Throwable error)
T
- the value typeerror
- the error Throwable to carry around in the notification, not nulljava.lang.NullPointerException
- if error is null
@NonNull public static <T> @NonNull Notification<T> createOnComplete()
onComplete
signal.T
- the target value typeonComplete
signal