public final class Notification<T>
extends java.lang.Object
Observable.| Modifier and Type | Class and Description |
|---|---|
static class |
Notification.Kind |
| 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)
Creates and returns a
Notification of variety Kind.OnCompleted. |
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 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.e - the exception to assign to the notificationOnError variety of Notificationpublic static <T> Notification<T> createOnCompleted()
Notification of variety Kind.OnCompleted.OnCompleted variety of Notificationpublic static <T> Notification<T> createOnCompleted(java.lang.Class<T> type)
Notification of variety Kind.OnCompleted.type - 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.public 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