eclipse / microprofile-reactive-streams-operators

Microprofile project
Apache License 2.0
79 stars 33 forks source link

How to turn Builder.flatMap into a Stage.FlatMap? #138

Closed akarnokd closed 4 years ago

akarnokd commented 4 years ago

The signature of ...Builder.flatMap(Function<? super T, ? extends PublisherBuilder<? extends S>> mapper) accepts PublisherBuilder. However, if I want to represent this method as a Stage.FlatMap to be used with buildRs(ReactiveStreamsEngine) via engine.buildPublisher(Graph), Stage.FlatMap requires a Function<T, Graph>.

How do I supposedly turn an arbitrary PublisherBuilder into a Graph? Should I create a mock engine so that when calling PublisherBuilder.buildRs(ReactiveStreamsEngine), it captures the Graph object sent to its buildPublisher(Graph)?

Azquelt commented 4 years ago

As you noted in #140, a compliant implementation of PublisherBuilder must also implement ToGraphable so you can just cast to ToGraphable and call toGraph().