public class MutableNextSignal<T> extends Signal<T>
Signal
flavour that is dedicated to the ON_NEXT
signal type and is mutable, allowing to minimize the number of Signal
instances
created.
Note this implementation is not serializable, and is for advanced usage. Instances
returned by the factory methods of Signal
should usually be used instead.
Modifier and Type | Method and Description |
---|---|
T |
get()
Retrieves the item associated with this (onNext) signal.
|
Subscription |
getSubscription()
Read the subscription associated with this (onSubscribe) signal.
|
Throwable |
getThrowable()
Read the error associated with this (onError) signal.
|
SignalType |
getType()
Read the type of this signal:
SignalType.ON_SUBSCRIBE ,
SignalType.ON_NEXT , SignalType.ON_ERROR , or
SignalType.ON_COMPLETE |
Signal<T> |
mutate(T newT)
Mutate this
Signal instance with a new value as an alternative
to creating a new instance. |
static <T> MutableNextSignal<T> |
of(T value)
Create a new
MutableNextSignal with an initial value. |
static <T> MutableNextSignal<T> |
undefined()
Create a new
MutableNextSignal that hasn't had a value set yet. |
accept, complete, equals, error, hasError, hashCode, hasValue, isComplete, isError, isOnComplete, isOnError, isOnNext, isOnSubscribe, next, subscribe, toString
public static <T> MutableNextSignal<T> undefined()
MutableNextSignal
that hasn't had a value set yet.T
- the type of the onNext elements.Signal
public static <T> MutableNextSignal<T> of(T value)
MutableNextSignal
with an initial value.T
- the type of the onNext elements.value
- the initial value.Signal
public Throwable getThrowable()
Signal
getThrowable
in class Signal<T>
public Subscription getSubscription()
Signal
getSubscription
in class Signal<T>
public T get()
Signal
public SignalType getType()
Signal
SignalType.ON_SUBSCRIBE
,
SignalType.ON_NEXT
, SignalType.ON_ERROR
, or
SignalType.ON_COMPLETE
public Signal<T> mutate(T newT)
Signal
instance with a new value as an alternative
to creating a new instance. The method returns this instance so it can
be used in places where a new Signal would have been created.newT
- the new onNext value