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, toStringpublic static <T> MutableNextSignal<T> undefined()
MutableNextSignal that hasn't had a value set yet.T - the type of the onNext elements.Signalpublic static <T> MutableNextSignal<T> of(T value)
MutableNextSignal with an initial value.T - the type of the onNext elements.value - the initial value.Signalpublic Throwable getThrowable()
SignalgetThrowable in class Signal<T>public Subscription getSubscription()
SignalgetSubscription in class Signal<T>public T get()
Signalpublic SignalType getType()
SignalSignalType.ON_SUBSCRIBE,
SignalType.ON_NEXT, SignalType.ON_ERROR, or
SignalType.ON_COMPLETEpublic 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