public final class

Notification

extends Object
java.lang.Object
   ↳ io.reactivex.Notification<T>

Class Overview

Represents the reactive signal types: onNext, onError and onComplete and holds their parameter values (a value, a Throwable, nothing).

Summary

Public Methods
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()
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static Notification<T> createOnComplete ()

Returns the empty and stateless shared instance of a notification representing an onComplete signal.

Returns
  • the shared Notification instance representing an onComplete signal

public static Notification<T> createOnError (Throwable error)

Constructs an onError notification containing the error.

Parameters
error the error Throwable to carry around in the notification, not null
Returns
  • the new Notification instance
Throws
NullPointerException if error is null

public static Notification<T> createOnNext (T value)

Constructs an onNext notification containing the given value.

Parameters
value the value to carry around in the notification, not null
Returns
  • the new Notification instance
Throws
NullPointerException if value is null

public boolean equals (Object obj)

public Throwable getError ()

Returns the container Throwable error if this notification is an onError signal, null otherwise.

Returns
  • the Throwable error contained or null
See Also

public T getValue ()

Returns the contained value if this notification is an onNext signal, null otherwise.

Returns
  • the value contained or null
See Also

public int hashCode ()

public boolean isOnComplete ()

Returns true if this notification is an onComplete signal.

Returns
  • true if this notification is an onComplete signal

public boolean isOnError ()

Returns true if this notification is an onError signal and getError() returns the contained Throwable.

Returns
  • true if this notification is an onError signal
See Also

public boolean isOnNext ()

Returns true if this notification is an onNext signal and getValue() returns the contained value.

Returns
  • true if this notification is an onNext signal
See Also

public String toString ()