Top Description Methods
reactor.core.publisher

public Interface Signal<T>

extends Supplier<T>, Consumer<Subscriber<? super T>>
Known Direct Implementers
reactor.core.publisher.MonoCacheTime.CoordinatorSubscriber, reactor.core.publisher.ImmutableSignal, reactor.core.publisher.FluxDoOnEach.DoOnEachSubscriber
Type Parameters
<T>
the value type
Imports
java.util.function.Consumer, .Supplier, org.reactivestreams.Subscriber, .Subscription, reactor.util.annotation.Nullable, reactor.util.context.Context, .ContextView

A domain representation of a Reactive Stream signal. There are 4 distinct signals and their possible sequence is defined as such: onError | (onSubscribe onNext* (onError | onComplete)?)
Author
Stephane Maldini

Method Summary

Modifier and TypeMethod and Description
public default void
accept(Subscriber<? super T>
the Subscriber to play the Signal on
observer
)

Implements java.util.function.Consumer.accept.

Propagate the signal represented by this Signal instance to a given Subscriber.
public static <
the value type
T
>
Signal<T>

Returns:

an OnCompleted variety of Signal
complete
()

Creates and returns a Signal of variety Type.COMPLETE.

public static <
the value type
T
>
Signal<T>

Returns:

an OnCompleted variety of Signal
complete
(Context
the Context associated with the completing source.
context
)

Creates and returns a Signal of variety Type.COMPLETE, associated with a specific Context.

public static <
the value type
T
>
Signal<T>

Returns:

an OnError variety of Signal
error
(Throwable
the error associated to the signal
e
)

Creates and returns a Signal of variety Type.FAILED, which holds the error.

public static <
the value type
T
>
Signal<T>

Returns:

an OnError variety of Signal
error
(Throwable
the error associated to the signal
e
,
Context
the Context associated with the erroring source
context
)

Creates and returns a Signal of variety Type.FAILED, which holds the error and the Context associated with the erroring source.

public T

Returns:

the item associated with this (onNext) signal, or null if not relevant
get
()

Redeclares java.util.function.Supplier.get.

Retrieves the item associated with this (onNext) signal.
public ContextView

Returns:

a readonly ContextView, or an empty one if no context is available.
getContextView
()

Return the readonly ContextView that is accessible by the time this Signal was emitted.

public Subscription

Returns:

the Subscription associated with this (onSubscribe) signal, or null if not relevant
getSubscription
()

Read the subscription associated with this (onSubscribe) signal.

public Throwable

Returns:

the Throwable associated with this (onError) signal, or null if not relevant
getThrowable
()

Read the error associated with this (onError) signal.

public SignalType

Returns:

the type of the signal
getType
()

Read the type of this signal: SignalType#ON_SUBSCRIBE, SignalType#ON_NEXT, SignalType#ON_ERROR, or SignalType#ON_COMPLETE

public default boolean

Returns:

a boolean indicating whether this signal has an error
hasError
()

Read whether this signal is on error and carries the cause.

public default boolean

Returns:

a boolean indicating whether or not this signal has an item associated with it
hasValue
()

Has this signal an item associated with it ?

public static boolean

Returns:

true if object represents the completion signal
isComplete
(Object
the object to check
o
)

Check if an arbitrary Object represents a COMPLETE Signal.

public static boolean

Returns:

true if object represents the error signal
isError
(Object
the object to check
o
)

Check if a arbitrary Object represents an ERROR Signal.

public default boolean

Returns:

a boolean indicating whether this signal represents an onComplete event
isOnComplete
()

Indicates whether this signal represents an onComplete event.

public default boolean

Returns:

a boolean indicating whether this signal represents an onError event
isOnError
()

Indicates whether this signal represents an onError event.

public default boolean

Returns:

a boolean indicating whether this signal represents an onNext event
isOnNext
()

Indicates whether this signal represents an onNext event.

public default boolean

Returns:

a boolean indicating whether this signal represents an onSubscribe event
isOnSubscribe
()

Indicates whether this signal represents an onSubscribe event.

public static <
the value type
T
>
Signal<T>

Returns:

an OnNext variety of Signal
next
(T
the value item associated to the signal
t
)

Creates and returns a Signal of variety Type.NEXT, which holds the value.

public static <
the value type
T
>
Signal<T>

Returns:

an OnNext variety of Signal
next
(T
the value item associated to the signal
t
,
Context
the Context associated with the emitting source
context
)

Creates and returns a Signal of variety Type.NEXT, which holds the value and the Context associated with the emitting source.

public static <
the value type
T
>
Signal<T>

Returns:

an OnSubscribe variety of Signal
subscribe
(Subscription
the subscription
subscription
)

Creates and returns a Signal of variety Type.ON_SUBSCRIBE.

public static <
the value type
T
>
Signal<T>

Returns:

an OnSubscribe variety of Signal
subscribe
(Subscription
the subscription
subscription
,
Context
the Context associated with the subscribed source
context
)

Creates and returns a Signal of variety Type.ON_SUBSCRIBE, that holds the Context associated with the subscribed source.

Inherited from java.util.function.Consumer:
andThen

Method Detail

acceptback to summary
public default void accept(Subscriber<? super T> observer)

Implements java.util.function.Consumer.accept.

Propagate the signal represented by this Signal instance to a given Subscriber.

Parameters
observer:Subscriber<? super T>

the Subscriber to play the Signal on

Annotations
@Override
completeback to summary
public static <T> Signal<T> complete()

Creates and returns a Signal of variety Type.COMPLETE.

Note that this variant associates an empty Context with the Signal.

Parameters
<T>
the value type
Returns:Signal<T>

an OnCompleted variety of Signal

completeback to summary
public static <T> Signal<T> complete(Context context)

Creates and returns a Signal of variety Type.COMPLETE, associated with a specific Context.

Parameters
<T>
the value type
context:Context

the Context associated with the completing source.

Returns:Signal<T>

an OnCompleted variety of Signal

errorback to summary
public static <T> Signal<T> error(Throwable e)

Creates and returns a Signal of variety Type.FAILED, which holds the error.

Note that this variant associates an empty Context with the Signal.

Parameters
<T>
the value type
e:Throwable

the error associated to the signal

Returns:Signal<T>

an OnError variety of Signal

errorback to summary
public static <T> Signal<T> error(Throwable e, Context context)

Creates and returns a Signal of variety Type.FAILED, which holds the error and the Context associated with the erroring source.

Parameters
<T>
the value type
e:Throwable

the error associated to the signal

context:Context

the Context associated with the erroring source

Returns:Signal<T>

an OnError variety of Signal

getback to summary
public T get()

Redeclares java.util.function.Supplier.get.

Retrieves the item associated with this (onNext) signal.

Returns:T

the item associated with this (onNext) signal, or null if not relevant

Annotations
@Override
@Nullable
getContextViewback to summary
public ContextView getContextView()

Return the readonly ContextView that is accessible by the time this Signal was emitted.

Returns:ContextView

a readonly ContextView, or an empty one if no context is available.

getSubscriptionback to summary
public Subscription getSubscription()

Read the subscription associated with this (onSubscribe) signal.

Returns:Subscription

the Subscription associated with this (onSubscribe) signal, or null if not relevant

Annotations
@Nullable
getThrowableback to summary
public Throwable getThrowable()

Read the error associated with this (onError) signal.

Returns:Throwable

the Throwable associated with this (onError) signal, or null if not relevant

Annotations
@Nullable
getTypeback to summary
public SignalType getType()

Read the type of this signal: SignalType#ON_SUBSCRIBE, SignalType#ON_NEXT, SignalType#ON_ERROR, or SignalType#ON_COMPLETE

Returns:SignalType

the type of the signal

hasErrorback to summary
public default boolean hasError()

Read whether this signal is on error and carries the cause.

Returns:boolean

a boolean indicating whether this signal has an error

hasValueback to summary
public default boolean hasValue()

Has this signal an item associated with it ? (which only happens if it is an (onNext) signal)

Returns:boolean

a boolean indicating whether or not this signal has an item associated with it

isCompleteback to summary
public static boolean isComplete(Object o)

Check if an arbitrary Object represents a COMPLETE Signal.

Parameters
o:Object

the object to check

Returns:boolean

true if object represents the completion signal

isErrorback to summary
public static boolean isError(Object o)

Check if a arbitrary Object represents an ERROR Signal.

Parameters
o:Object

the object to check

Returns:boolean

true if object represents the error signal

isOnCompleteback to summary
public default boolean isOnComplete()

Indicates whether this signal represents an onComplete event.

Returns:boolean

a boolean indicating whether this signal represents an onComplete event

isOnErrorback to summary
public default boolean isOnError()

Indicates whether this signal represents an onError event.

Returns:boolean

a boolean indicating whether this signal represents an onError event

isOnNextback to summary
public default boolean isOnNext()

Indicates whether this signal represents an onNext event.

Returns:boolean

a boolean indicating whether this signal represents an onNext event

isOnSubscribeback to summary
public default boolean isOnSubscribe()

Indicates whether this signal represents an onSubscribe event.

Returns:boolean

a boolean indicating whether this signal represents an onSubscribe event

nextback to summary
public static <T> Signal<T> next(T t)

Creates and returns a Signal of variety Type.NEXT, which holds the value.

Note that this variant associates an empty Context with the Signal.

Parameters
<T>
the value type
t:T

the value item associated to the signal

Returns:Signal<T>

an OnNext variety of Signal

nextback to summary
public static <T> Signal<T> next(T t, Context context)

Creates and returns a Signal of variety Type.NEXT, which holds the value and the Context associated with the emitting source.

Parameters
<T>
the value type
t:T

the value item associated to the signal

context:Context

the Context associated with the emitting source

Returns:Signal<T>

an OnNext variety of Signal

subscribeback to summary
public static <T> Signal<T> subscribe(Subscription subscription)

Creates and returns a Signal of variety Type.ON_SUBSCRIBE.

Note that this variant associates an empty Context with the Signal.

Parameters
<T>
the value type
subscription:Subscription

the subscription

Returns:Signal<T>

an OnSubscribe variety of Signal

subscribeback to summary
public static <T> Signal<T> subscribe(Subscription subscription, Context context)

Creates and returns a Signal of variety Type.ON_SUBSCRIBE, that holds the Context associated with the subscribed source.

Parameters
<T>
the value type
subscription:Subscription

the subscription

context:Context

the Context associated with the subscribed source

Returns:Signal<T>

an OnSubscribe variety of Signal