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<T>fromPublisher
(P publisher) Creates anAsyncGenerator
from aFlow.Publisher
.static <T> Flow.Publisher<T>
toPublisher
(AsyncGenerator<T> generator) Converts anAsyncGenerator
into aFlow.Publisher
.
-
Method Details
-
fromPublisher
Creates anAsyncGenerator
from 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
AsyncGenerator
that emits items from the publisher
-
toPublisher
Converts anAsyncGenerator
into aFlow.Publisher
.- Type Parameters:
T
- the type of elements emitted by the publisher- Parameters:
generator
- the async generator to convert- Returns:
- a flow publisher
-