T - the actual value type held by the Notificationpublic final class Notification<T>
extends java.lang.Object
Observable.| Modifier and Type | Class and Description |
|---|---|
static class |
Notification.Kind
Specifies the kind of the notification: an element, an error or a completion notification.
|
| Modifier and Type | Method and Description |
|---|---|
void |
accept(Observer<? super T> observer)
Forwards this notification on to a specified
Observer. |
static <T> Notification<T> |
createOnCompleted()
Creates and returns a
Notification of variety Kind.OnCompleted. |
static <T> Notification<T> |
createOnCompleted(java.lang.Class<T> type)
Deprecated.
this method does the same as
createOnCompleted() and does not use the passed in type hence it's useless. |
static <T> Notification<T> |
createOnError(java.lang.Throwable e)
Creates and returns a
Notification of variety Kind.OnError, and assigns it an exception. |
static <T> Notification<T> |
createOnNext(T t)
Creates and returns a
Notification of variety Kind.OnNext, and assigns it a value. |
boolean |
equals(java.lang.Object obj) |
Notification.Kind |
getKind()
Retrieves the kind of this notification:
OnNext, OnError, or OnCompleted |
java.lang.Throwable |
getThrowable()
Retrieves the exception associated with this (onError) notification.
|
T |
getValue()
Retrieves the item associated with this (onNext) notification.
|
int |
hashCode() |
boolean |
hasThrowable()
Indicates whether this notification has an exception associated with it.
|
boolean |
hasValue()
Indicates whether this notification has an item associated with it.
|
boolean |
isOnCompleted()
Indicates whether this notification represents an
onCompleted event. |
boolean |
isOnError()
Indicates whether this notification represents an
onError event. |
boolean |
isOnNext()
Indicates whether this notification represents an
onNext event. |
java.lang.String |
toString() |
public static <T> Notification<T> createOnNext(T t)
Notification of variety Kind.OnNext, and assigns it a value.T - the actual value type held by the Notificationt - the item to assign to the notification as its valueOnNext variety of Notificationpublic static <T> Notification<T> createOnError(java.lang.Throwable e)
Notification of variety Kind.OnError, and assigns it an exception.T - the actual value type held by the Notificatione - the exception to assign to the notificationOnError variety of Notificationpublic static <T> Notification<T> createOnCompleted()
Notification of variety Kind.OnCompleted.T - the actual value type held by the NotificationOnCompleted variety of Notification@Deprecated public static <T> Notification<T> createOnCompleted(java.lang.Class<T> type)
createOnCompleted() and does not use the passed in type hence it's useless.Notification of variety Kind.OnCompleted.T - the actual value type held by the Notificationtype - the type token to help with type inference of <T>OnCompleted variety of Notificationpublic java.lang.Throwable getThrowable()
public T getValue()
public boolean hasValue()
public boolean hasThrowable()
public Notification.Kind getKind()
OnNext, OnError, or OnCompletedOnNext, OnError, or OnCompletedpublic boolean isOnError()
onError event.onError eventpublic boolean isOnCompleted()
onCompleted event.onCompleted eventpublic boolean isOnNext()
onNext event.onNext eventpublic void accept(Observer<? super T> observer)
Observer.observer - the target observer to call onXXX methods on based on the kind of this Notification instancepublic java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object