Class CompletionStageMappingPublisher<D,​U>

  • Type Parameters:
    D - the downstream type
    U - the upstream type to be mapped to
    All Implemented Interfaces:
    org.reactivestreams.Publisher<D>
    Direct Known Subclasses:
    CompletionStageMappingOrderedPublisher

    public class CompletionStageMappingPublisher<D,​U>
    extends java.lang.Object
    implements org.reactivestreams.Publisher<D>
    A reactive Publisher that bridges over another Publisher of `D` and maps the results to type `U` via a CompletionStage, handling errors in that stage
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.function.Function<U,​java.util.concurrent.CompletionStage<D>> mapper  
      protected org.reactivestreams.Publisher<U> upstreamPublisher  
    • Constructor Summary

      Constructors 
      Constructor Description
      CompletionStageMappingPublisher​(org.reactivestreams.Publisher<U> upstreamPublisher, java.util.function.Function<U,​java.util.concurrent.CompletionStage<D>> mapper)
      You need the following :
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected @NotNull org.reactivestreams.Subscriber<? super U> createSubscriber​(org.reactivestreams.Subscriber<? super D> downstreamSubscriber)  
      org.reactivestreams.Publisher<U> getUpstreamPublisher()
      Get instance of an upstreamPublisher
      void subscribe​(org.reactivestreams.Subscriber<? super D> downstreamSubscriber)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • upstreamPublisher

        protected final org.reactivestreams.Publisher<U> upstreamPublisher
      • mapper

        protected final java.util.function.Function<U,​java.util.concurrent.CompletionStage<D>> mapper
    • Constructor Detail

      • CompletionStageMappingPublisher

        public CompletionStageMappingPublisher​(org.reactivestreams.Publisher<U> upstreamPublisher,
                                               java.util.function.Function<U,​java.util.concurrent.CompletionStage<D>> mapper)
        You need the following :
        Parameters:
        upstreamPublisher - an upstream source of data
        mapper - a mapper function that turns upstream data into a promise of mapped D downstream data
    • Method Detail

      • subscribe

        public void subscribe​(org.reactivestreams.Subscriber<? super D> downstreamSubscriber)
        Specified by:
        subscribe in interface org.reactivestreams.Publisher<D>
      • createSubscriber

        @NotNull
        protected @NotNull org.reactivestreams.Subscriber<? super U> createSubscriber​(org.reactivestreams.Subscriber<? super D> downstreamSubscriber)
      • getUpstreamPublisher

        public org.reactivestreams.Publisher<U> getUpstreamPublisher()
        Get instance of an upstreamPublisher
        Returns:
        upstream instance of Publisher