T
- the value typepublic final class Notification<T> extends Object
Modifier and Type | Method and Description |
---|---|
static <T> Notification<T> |
createOnComplete()
Returns the empty and stateless shared instance of a notification representing
an onComplete signal.
|
static <T> Notification<T> |
createOnError(Throwable error)
Constructs an onError notification containing the error.
|
static <T> Notification<T> |
createOnNext(T value)
Constructs an onNext notification containing the given value.
|
boolean |
equals(Object obj) |
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. |
String |
toString() |
public boolean isOnComplete()
public boolean isOnError()
getError()
returns the contained Throwable.getError()
public boolean isOnNext()
getValue()
returns the contained value.getValue()
@Nullable public T getValue()
isOnNext()
@Nullable public Throwable getError()
isOnError()
@NonNull public static <T> Notification<T> createOnNext(@NonNull T value)
T
- the value typevalue
- the value to carry around in the notification, not nullNullPointerException
- if value is null@NonNull public static <T> Notification<T> createOnError(@NonNull Throwable error)
T
- the value typeerror
- the error Throwable to carry around in the notification, not nullNullPointerException
- if error is null@NonNull public static <T> Notification<T> createOnComplete()
T
- the target value type