T - the value typepublic abstract class Signal<T> extends Object implements Supplier<T>, Consumer<Subscriber<? super T>>
| Constructor and Description |
|---|
Signal() |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(Subscriber<? super T> observer)
Propagate the signal represented by this
Signal instance to a
given Subscriber. |
static <T> Signal<T> |
complete()
Creates and returns a
Signal of variety Type.COMPLETE. |
boolean |
equals(Object o) |
static <T> Signal<T> |
error(Throwable e)
Creates and returns a
Signal of variety Type.FAILED, which holds
the error. |
abstract T |
get()
Retrieves the item associated with this (onNext) signal.
|
abstract Subscription |
getSubscription()
Read the subscription associated with this (onSubscribe) signal.
|
abstract Throwable |
getThrowable()
Read the error associated with this (onError) signal.
|
abstract SignalType |
getType()
Read the type of this signal:
SignalType.ON_SUBSCRIBE,
SignalType.ON_NEXT, SignalType.ON_ERROR, or
SignalType.ON_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 ? (which only happens if it is an
(onNext) signal)
|
static boolean |
isComplete(Object o)
Check if an arbitrary Object represents a COMPLETE
Signal. |
static boolean |
isError(Object o)
Check if a arbitrary Object represents an ERROR
Signal. |
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, which holds
the value. |
static <T> Signal<T> |
subscribe(Subscription subscription)
Creates and returns a
Signal of variety Type.ON_SUBSCRIBE. |
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(Throwable e)
Signal of variety Type.FAILED, which holds
the error.T - the value typee - the error associated to the signalOnError variety of Signalpublic static <T> Signal<T> next(T t)
Signal of variety Type.NEXT, which holds
the value.T - the value typet - the value item associated to the signalOnNext variety of Signalpublic static boolean isComplete(Object o)
Signal.o - the object to checkpublic static boolean isError(Object o)
Signal.o - the object to checkpublic static <T> Signal<T> subscribe(Subscription subscription)
Signal of variety Type.ON_SUBSCRIBE.T - the value typesubscription - the subscriptionOnSubscribe variety of Signal@Nullable public abstract Throwable getThrowable()
@Nullable public abstract Subscription getSubscription()
public boolean hasValue()
public boolean hasError()
public abstract SignalType getType()
SignalType.ON_SUBSCRIBE,
SignalType.ON_NEXT, SignalType.ON_ERROR, or
SignalType.ON_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(Subscriber<? super T> observer)
Signal instance to a
given Subscriber.accept in interface Consumer<Subscriber<? super T>>observer - the Subscriber to play the Signal on