public interface FlowGenerator
Provides methods for converting between
FlowGenerator and various Flow.Publisher types.- Since:
- 3.0.0
-
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic <T,P extends Flow.Publisher<T>>
AsyncGenerator.Cancellable<T>fromPublisher(P publisher) Creates anAsyncGeneratorfrom aFlow.Publisher.static <T,P extends Flow.Publisher<T>, R>
AsyncGenerator.Cancellable<T>fromPublisher(P publisher, Supplier<R> mapResult) Creates anAsyncGeneratorfrom aFlow.Publisher.static <T> Flow.Publisher<T>toPublisher(AsyncGenerator<T> generator) Converts anAsyncGeneratorinto aFlow.Publisher.
-
Method Details
-
fromPublisher
static <T,P extends Flow.Publisher<T>, AsyncGenerator.Cancellable<T> fromPublisherR> (P publisher, Supplier<R> mapResult) Creates anAsyncGeneratorfrom aFlow.Publisher.- Type Parameters:
T- the type of item emitted by the publisherP- the type of the publisher- Parameters:
publisher- the publisher to subscribe to for retrieving items asynchronouslymapResult- function that will set generator's result- Returns:
- an
AsyncGeneratorthat emits items from the publisher
-
fromPublisher
Creates anAsyncGeneratorfrom aFlow.Publisher.- Type Parameters:
T- the type of item emitted by the publisherP- the type of the publisher- Parameters:
publisher- the publisher to subscribe to for retrieving items asynchronously- Returns:
- an
AsyncGeneratorthat emits items from the publisher
-
toPublisher
Converts anAsyncGeneratorinto aFlow.Publisher.- Type Parameters:
T- the type of elements emitted by the publisher- Parameters:
generator- the async generator to convert- Returns:
- a flow publisher
-