public final class Signal<T>
extends java.lang.Object
implements reactor.fn.Supplier<T>, reactor.fn.Consumer<org.reactivestreams.Subscriber<? super T>>, java.io.Serializable
Stream signal.
There are 4 differents signals and their possible sequence is defined as such:
onError | (onSubscribe onNext* (onError | onComplete)?)| Modifier and Type | Class and Description |
|---|---|
static class |
Signal.Type |
| 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.ERROR, and assigns it an exception. |
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 exception associated with this (onError) signal.
|
Signal.Type |
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 ?
|
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.COMPLETE. |
java.lang.String |
toString() |
public static <T> Signal<T> next(T t)
Signal of variety Type.NEXT, and assigns it a value.t - the item to assign to the signal as its valueOnNext variety of Signalpublic static <T> Signal<T> error(java.lang.Throwable e)
Signal of variety Type.ERROR, and assigns it an exception.e - the exception to assign to the signalOnError variety of Signalpublic static <T> Signal<T> complete()
Signal of variety Type.COMPLETE.OnCompleted variety of Signalpublic static <T> Signal<T> subscribe(org.reactivestreams.Subscription subscription)
Signal of variety Type.COMPLETE.subscription - the subscriptionOnCompleted variety of Signalpublic java.lang.Throwable getThrowable()
public org.reactivestreams.Subscription getSubscription()
public T get()
get in interface reactor.fn.Supplier<T>public boolean hasValue()
public boolean hasError()
public Signal.Type 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 reactor.fn.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