Package rx
Class Notification<T>
java.lang.Object
rx.Notification<T>
- Type Parameters:
T
- the actual value type held by the Notification
An object representing a notification sent to an
Observable
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Specifies the kind of the notification: an element, an error or a completion notification. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Notification.Kind
private static final Notification
<Void> private final Throwable
private final T
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Forwards this notification on to a specifiedObserver
.static <T> Notification
<T> Creates and returns aNotification
of varietyKind.OnCompleted
.static <T> Notification
<T> createOnCompleted
(Class<T> type) Creates and returns aNotification
of varietyKind.OnCompleted
.static <T> Notification
<T> Creates and returns aNotification
of varietyKind.OnError
, and assigns it an exception.static <T> Notification
<T> createOnNext
(T t) Creates and returns aNotification
of varietyKind.OnNext
, and assigns it a value.boolean
getKind()
Retrieves the kind of this notification:OnNext
,OnError
, orOnCompleted
Retrieves the exception associated with this (onError) notification.getValue()
Retrieves the item associated with this (onNext) notification.int
hashCode()
boolean
Indicates whether this notification has an exception associated with it.boolean
hasValue()
Indicates whether this notification has an item associated with it.boolean
Indicates whether this notification represents anonCompleted
event.boolean
Indicates whether this notification represents anonError
event.boolean
isOnNext()
Indicates whether this notification represents anonNext
event.toString()
-
Field Details
-
kind
-
throwable
-
value
-
ON_COMPLETED
-
-
Constructor Details
-
Notification
-
-
Method Details
-
createOnNext
Creates and returns aNotification
of varietyKind.OnNext
, and assigns it a value.- Type Parameters:
T
- the actual value type held by the Notification- Parameters:
t
- the item to assign to the notification as its value- Returns:
- an
OnNext
variety ofNotification
-
createOnError
Creates and returns aNotification
of varietyKind.OnError
, and assigns it an exception.- Type Parameters:
T
- the actual value type held by the Notification- Parameters:
e
- the exception to assign to the notification- Returns:
- an
OnError
variety ofNotification
-
createOnCompleted
Creates and returns aNotification
of varietyKind.OnCompleted
.- Type Parameters:
T
- the actual value type held by the Notification- Returns:
- an
OnCompleted
variety ofNotification
-
createOnCompleted
Creates and returns aNotification
of varietyKind.OnCompleted
.- Type Parameters:
T
- the actual value type held by the Notification- Parameters:
type
-- Returns:
- an
OnCompleted
variety ofNotification
-
getThrowable
Retrieves the exception associated with this (onError) notification.- Returns:
- the Throwable associated with this (onError) notification
-
getValue
Retrieves the item associated with this (onNext) notification.- Returns:
- the item associated with this (onNext) notification
-
hasValue
public boolean hasValue()Indicates whether this notification has an item associated with it.- Returns:
- a boolean indicating whether or not this notification has an item associated with it
-
hasThrowable
public boolean hasThrowable()Indicates whether this notification has an exception associated with it.- Returns:
- a boolean indicating whether this notification has an exception associated with it
-
getKind
Retrieves the kind of this notification:OnNext
,OnError
, orOnCompleted
- Returns:
- the kind of the notification:
OnNext
,OnError
, orOnCompleted
-
isOnError
public boolean isOnError()Indicates whether this notification represents anonError
event.- Returns:
- a boolean indicating whether this notification represents an
onError
event
-
isOnCompleted
public boolean isOnCompleted()Indicates whether this notification represents anonCompleted
event.- Returns:
- a boolean indicating whether this notification represents an
onCompleted
event
-
isOnNext
public boolean isOnNext()Indicates whether this notification represents anonNext
event.- Returns:
- a boolean indicating whether this notification represents an
onNext
event
-
accept
Forwards this notification on to a specifiedObserver
.- Parameters:
observer
- the target observer to call onXXX methods on based on the kind of this Notification instance
-
toString
-
hashCode
public int hashCode() -
equals
-