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) |
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 , and assigns it
an 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:
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(Object o) |
static boolean |
isError(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(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 Signal
public static <T> Signal<T> error(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 Signal
public 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 Signal
public static boolean isComplete(Object o)
o
- is the given object a complete Signal
public static boolean isError(Object o)
o
- is the given object a complete Signal
public static <T> Signal<T> subscribe(Subscription subscription)
Signal
of variety Type.ON_SUBSCRIBE
.T
- the value typesubscription
- the subscriptionOnCompleted
variety of Signal
public abstract Throwable getThrowable()
public abstract Subscription getSubscription()
public abstract T get()
public boolean hasValue()
public boolean hasError()
public abstract SignalType getType()
Subscribe
, Next
, Error
, or
Complete
public 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)
accept
in interface Consumer<Subscriber<? super T>>