Package io.servicetalk.concurrent.api
Interface ScanWithMapper<T,R>
-
- Type Parameters:
T
- Type of items emitted by thePublisher
this operator is applied.R
- Type of items emitted by this operator.
- All Known Subinterfaces:
ScanWithLifetimeMapper<T,R>
public interface ScanWithMapper<T,R>
Provides the ability to transform (aka map) signals emitted via thePublisher.scanWith(Supplier)
operator.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description R
mapOnComplete()
Invoked when aPublisherSource.Subscriber.onComplete()
signal is received, and maps the current state into an object of typeScanWithMapper
which will be emitted downstream asPublisherSource.Subscriber.onNext(Object)
, followed byPublisherSource.Subscriber.onComplete()
.R
mapOnError(java.lang.Throwable cause)
Invoked when aPublisherSource.Subscriber.onError(Throwable)
signal is received, and maps the current state into an object of typeScanWithMapper
which will be emitted downstream asPublisherSource.Subscriber.onNext(Object)
, followed byPublisherSource.Subscriber.onComplete()
.R
mapOnNext(T next)
Invoked on eachPublisherSource.Subscriber.onNext(Object)
signal and maps from typeScanWithMapper
to typeScanWithMapper
.boolean
mapTerminal()
Invoked when a terminal signal is received and determines if an additionalPublisherSource.Subscriber.onNext(Object)
signal will be emitted downstream.
-
-
-
Method Detail
-
mapOnNext
@Nullable R mapOnNext(@Nullable T next)
Invoked on eachPublisherSource.Subscriber.onNext(Object)
signal and maps from typeScanWithMapper
to typeScanWithMapper
.- Parameters:
next
- The next element emitted fromPublisherSource.Subscriber.onNext(Object)
.- Returns:
- The result of mapping
next
.
-
mapOnError
@Nullable R mapOnError(java.lang.Throwable cause) throws java.lang.Throwable
Invoked when aPublisherSource.Subscriber.onError(Throwable)
signal is received, and maps the current state into an object of typeScanWithMapper
which will be emitted downstream asPublisherSource.Subscriber.onNext(Object)
, followed byPublisherSource.Subscriber.onComplete()
.If this method throws the exception will be propagated downstream via
PublisherSource.Subscriber.onError(Throwable)
.This method is only invoked if
mapTerminal()
returnedtrue
.- Parameters:
cause
- The cause from upstreamPublisherSource.Subscriber.onError(Throwable)
.- Returns:
- An object of type
ScanWithMapper
which will be emitted downstream asPublisherSource.Subscriber.onNext(Object)
. - Throws:
java.lang.Throwable
- If an exception occurs, which will be propagated downstream viaPublisherSource.Subscriber.onError(Throwable)
.
-
mapOnComplete
@Nullable R mapOnComplete()
Invoked when aPublisherSource.Subscriber.onComplete()
signal is received, and maps the current state into an object of typeScanWithMapper
which will be emitted downstream asPublisherSource.Subscriber.onNext(Object)
, followed byPublisherSource.Subscriber.onComplete()
.If this method throws the exception will be propagated downstream via
PublisherSource.Subscriber.onError(Throwable)
.This method is only invoked if
mapTerminal()
returnedtrue
.- Returns:
- An object of type
ScanWithMapper
which will be emitted downstream asPublisherSource.Subscriber.onNext(Object)
.
-
mapTerminal
boolean mapTerminal()
Invoked when a terminal signal is received and determines if an additionalPublisherSource.Subscriber.onNext(Object)
signal will be emitted downstream.- Returns:
- If this method returns
true
then themapOnError(Throwable)
ormapOnComplete()
will be invoked when their respective terminal signals are received. Otherwise neithermapOnError(Throwable)
normapOnComplete()
will be invoked and any terminal signal will be passed through directly (no mapping, no additionalPublisherSource.Subscriber.onNext(Object)
).
-
-