Module io.helidon.common.reactive
Package io.helidon.common.reactive
Class MappingProcessor<SOURCE,TARGET>
- java.lang.Object
-
- io.helidon.common.reactive.MappingProcessor<SOURCE,TARGET>
-
- Type Parameters:
SOURCE- type of the publisher we subscribe toTARGET- type of the publisher we expose
- All Implemented Interfaces:
Flow.Processor<SOURCE,TARGET>,Flow.Publisher<TARGET>,Flow.Subscriber<SOURCE>
public final class MappingProcessor<SOURCE,TARGET> extends Object implements Flow.Processor<SOURCE,TARGET>
AFlow.Processorthat only maps the source type to target type using a mapping function.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <S,T>
MappingProcessor<S,T>create(Function<S,T> mappingFunction)Create a mapping processor for a mapping function.voidonComplete()voidonError(Throwable throwable)voidonNext(SOURCE item)voidonSubscribe(Flow.Subscription subscription)voidsubscribe(Flow.Subscriber<? super TARGET> subscriber)
-
-
-
Method Detail
-
create
public static <S,T> MappingProcessor<S,T> create(Function<S,T> mappingFunction)
Create a mapping processor for a mapping function.- Type Parameters:
S- Source typeT- Target type- Parameters:
mappingFunction- function that maps source to target (applied for each record)- Returns:
- a new mapping processor
-
subscribe
public void subscribe(Flow.Subscriber<? super TARGET> subscriber)
- Specified by:
subscribein interfaceFlow.Publisher<SOURCE>
-
onSubscribe
public void onSubscribe(Flow.Subscription subscription)
- Specified by:
onSubscribein interfaceFlow.Subscriber<SOURCE>
-
onNext
public void onNext(SOURCE item)
- Specified by:
onNextin interfaceFlow.Subscriber<SOURCE>
-
onError
public void onError(Throwable throwable)
- Specified by:
onErrorin interfaceFlow.Subscriber<SOURCE>
-
onComplete
public void onComplete()
- Specified by:
onCompletein interfaceFlow.Subscriber<SOURCE>
-
-