T - the value typepublic final class Signal<T>
extends java.lang.Object
implements java.util.function.Supplier<T>, java.util.function.Consumer<org.reactivestreams.Subscriber<? super T>>, java.io.Serializable
| Modifier and Type | Method and Description |
|---|---|
void |
accept(org.reactivestreams.Subscriber<? super T> observer) |
static <T> Signal<T> |
complete()
Creates and returns a
Signal of variety Type.COMPLETE. |
boolean |
equals(java.lang.Object o) |
static <T> Signal<T> |
error(java.lang.Throwable e)
Creates and returns a
Signal of variety Type.FAILED, and assigns it an error. |
T |
get()
Retrieves the item associated with this (onNext) signal.
|
org.reactivestreams.Subscription |
getSubscription()
Read the subscription associated with this (onSubscribe) signal.
|
java.lang.Throwable |
getThrowable()
Read the error associated with this (onError) signal.
|
SignalType |
getType()
Read the type of this signal:
Subscribe, Next, Error, or Complete |
boolean |
hasError()
Read whether this signal is on error and carries the cause.
|
int |
hashCode() |
boolean |
hasValue()
Has this signal an item associated with it ?
|
static boolean |
isComplete(java.lang.Object o) |
static boolean |
isError(java.lang.Object o) |
boolean |
isOnComplete()
Indicates whether this signal represents an
onComplete event. |
boolean |
isOnError()
Indicates whether this signal represents an
onError event. |
boolean |
isOnNext()
Indicates whether this signal represents an
onNext event. |
boolean |
isOnSubscribe()
Indicates whether this signal represents an
onSubscribe event. |
static <T> Signal<T> |
next(T t)
Creates and returns a
Signal of variety Type.NEXT, and assigns it a value. |
static <T> Signal<T> |
subscribe(org.reactivestreams.Subscription subscription)
Creates and returns a
Signal of variety Type.ON_SUBSCRIBE. |
java.lang.String |
toString() |
public static <T> Signal<T> complete()
Signal of variety Type.COMPLETE.T - the value typeOnCompleted variety of Signalpublic static <T> Signal<T> error(java.lang.Throwable e)
Signal of variety Type.FAILED, and assigns it an error.T - the value typee - the error to assign to the signalOnError variety of Signalpublic static <T> Signal<T> next(T t)
Signal of variety Type.NEXT, and assigns it a value.T - the value typet - the item to assign to the signal as its valueOnNext variety of Signalpublic static boolean isComplete(java.lang.Object o)
o - is the given object a complete Signalpublic static boolean isError(java.lang.Object o)
o - is the given object a complete Signalpublic static <T> Signal<T> subscribe(org.reactivestreams.Subscription subscription)
Signal of variety Type.ON_SUBSCRIBE.T - the value typesubscription - the subscriptionOnCompleted variety of Signalpublic java.lang.Throwable getThrowable()
public org.reactivestreams.Subscription getSubscription()
public T get()
get in interface java.util.function.Supplier<T>public boolean hasValue()
public boolean hasError()
public SignalType getType()
Subscribe, Next, Error, or Completepublic boolean isOnError()
onError event.onError eventpublic boolean isOnComplete()
onComplete event.onSubscribe eventpublic boolean isOnSubscribe()
onSubscribe event.onSubscribe eventpublic boolean isOnNext()
onNext event.onNext eventpublic void accept(org.reactivestreams.Subscriber<? super T> observer)
accept in interface java.util.function.Consumer<org.reactivestreams.Subscriber<? super T>>public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object