Class Mapper<T,R>

java.lang.Object
net.pincette.rs.ProcessorBase<T,R>
net.pincette.rs.Mapper<T,R>
Type Parameters:
T - the type of the incoming values.
R - the type of the outgoing values.
All Implemented Interfaces:
Flow.Processor<T,R>, Flow.Publisher<R>, Flow.Subscriber<T>
Direct Known Subclasses:
After, Before, Filter, HeadTail, NotFilter, PassThrough, Separator

public class Mapper<T,R> extends ProcessorBase<T,R>
Transforms a reactive stream. Null values are neither processed nor emitted.
Since:
1.0
Author:
Werner Donné
  • Constructor Details

  • Method Details

    • map

      public static <T, R> Flow.Processor<T,R> map(Function<T,R> map)
      Returns a mapping processor with a map function.
      Type Parameters:
      T - the type of the incoming values.
      R - the type of the outgoing values.
      Parameters:
      map - the map function.
      Returns:
      The processor.
      Since:
      3.0
    • canRequestMore

      protected boolean canRequestMore(long number)
      With this method a subclass can regulate the backpressure.
      Parameters:
      number - the strictly positive number of elements.
      Returns:
      true
      Since:
      1.6
    • emit

      protected void emit(long number)
      Specified by:
      emit in class ProcessorBase<T,R>
    • more

      protected void more()
      Request one more element from the upstream.
      Since:
      1.4
    • more

      protected void more(long number)
      Request more elements from the upstream. This will only have an effect when the stream is not in an error state.
      Parameters:
      number - the strictly positive number of elements.
      Since:
      1.4
    • onNext

      public void onNext(T value)