Object
TransformSubscriber<T,R>
- Type Parameters:
T
- input type (type of a Publisher)R
- output type (type of an existing Subscriber)
- All Implemented Interfaces:
Flow.Subscriber<T>
Transformer
Flow.Subscriber
allows to subscribe existing Flow.Subscriber
of type R to a
Flow.Publisher
of type T.
The transformation of items from T to R is done with a given transformer Function
-
Constructor Summary
ConstructorDescriptionTransformSubscriber
(Flow.Subscriber<? super R> targetSubscriber, Function<T, Optional<R>> transformer) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
void
onSubscribe
(Flow.Subscription subscription)
-
Constructor Details
-
TransformSubscriber
public TransformSubscriber(Flow.Subscriber<? super R> targetSubscriber, Function<T, Optional<R>> transformer) - Parameters:
transformer
- function to transform items fromFlow.Publisher
to targetFlow.Subscriber
. If transformer returns empty message it will be ignored.
-
-
Method Details
-
onSubscribe
- Specified by:
onSubscribe
in interfaceFlow.Subscriber<T>
-
onNext
- Specified by:
onNext
in interfaceFlow.Subscriber<T>
-
onError
- Specified by:
onError
in interfaceFlow.Subscriber<T>
-
onComplete
public void onComplete()- Specified by:
onComplete
in interfaceFlow.Subscriber<T>
-