public final class ComposedStreams
extends java.lang.Object
StreamIds that identify general purpose ReactiveStreams based on stream
composition. This class is experimental.| Modifier and Type | Method and Description |
|---|---|
static <X> StreamId<X> |
delayedStream(StreamId<X> sourceStreamId,
java.time.Duration duration)
|
static <X> StreamId<X> |
filteredStream(StreamId<X> sourceStreamId,
java.util.function.Predicate<X> predicate)
|
static <X,T> StreamId<T> |
flatMappedStream(StreamId<X> sourceStreamId,
java.util.function.Function<X,org.reactivestreams.Publisher<T>> conversion)
|
static <X,T> StreamId<T> |
mappedStream(StreamId<X> sourceStreamId,
java.util.function.Function<X,T> conversion)
|
static <X> StreamId<X> |
mergedStream(java.util.List<StreamId<X>> sourceStreamIds)
|
static <X,T> StreamId<T> |
zippedStream(StreamId<X> sourceStreamId1,
StreamId<X> sourceStreamId2,
java.util.function.BiFunction<X,X,java.util.Optional<T>> zip)
|
public static final <X,T> StreamId<T> mappedStream(StreamId<X> sourceStreamId, java.util.function.Function<X,T> conversion)
StreamId that will be used to create a ReactiveStream which will emit items based on a
ReactiveStream identified by the provided StreamId. The conversion function always returns an
Optional, if the value is present then it will be emitted, otherwise nothing will be emitted.sourceStreamId - StreamId which identifies a ReactiveStream that will be used as the source
of the converted objects.conversion - Function used to convert the objects.StreamId.java.lang.NullPointerException - If the provided source stream id or conversion function are null.MapCompositionFunctionpublic static final <X,T> StreamId<T> flatMappedStream(StreamId<X> sourceStreamId, java.util.function.Function<X,org.reactivestreams.Publisher<T>> conversion)
StreamId that will identify a ReactiveStream which will emit items based on a
ReactiveStream identified by the provided StreamId. The conversion function always returns a
ReactiveStream which will used as the source of the objects to be flattened, if the stream emits values
then these will be emitted, otherwise nothing will be emitted.sourceStreamId - StreamId which identifies the ReactiveStream that will be used as the
source of the converted objects.conversion - Function used to convert the objects.StreamId.java.lang.NullPointerException - If the provided source stream id or conversion function are null.FlatMapCompositionFunctionpublic static final <X> StreamId<X> mergedStream(java.util.List<StreamId<X>> sourceStreamIds)
public static final <X> StreamId<X> filteredStream(StreamId<X> sourceStreamId, java.util.function.Predicate<X> predicate)
StreamId that will be used to create a ReactiveStream which will filter and re-emit the
items emitted by the ReactiveStreams identified by the provided StreamId.sourceStreamId - StreamId which identifies the ReactiveStream that will be used as the
source of the filtered objects.predicate - Predicate that will be used to filter the items emitted by the source.StreamId.java.lang.NullPointerException - If the provided source stream id or predicate are null.FilterCompositionFunctionpublic static final <X> StreamId<X> delayedStream(StreamId<X> sourceStreamId, java.time.Duration duration)
StreamId that will be used to create a ReactiveStream which will re-emit all the items
emitted by the ReactiveStreams identified by the provided StreamId with the specified delay.sourceStreamId - StreamId which identifies the ReactiveStream that will be used as the
source of the emitted objects.duration - Duration that will be used as the delay before re-emitting.StreamId.java.lang.NullPointerException - If the provided source stream id or duration are null.DelayCompositionFunctionpublic static final <X,T> StreamId<T> zippedStream(StreamId<X> sourceStreamId1, StreamId<X> sourceStreamId2, java.util.function.BiFunction<X,X,java.util.Optional<T>> zip)
StreamId that will identify a ReactiveStream which will emit items generated using the
provided method and the values emitted by the ReactiveStreams identified by the provided StreamId
s. The zip function always returns an Optional, if the value is present then it will be emitted,
otherwise nothing will be emitted.sourceStreamId1 - StreamId which identifies the ReactiveStream that will be used as the
source of the objects used by the zip function.sourceStreamId2 - StreamId which identifies the ReactiveStream that will be used as the
source of the objects used by the zip function.zip - A BiFunction which will convert both objects emitted by the
ReactiveStreams into a single new instance of type T.StreamId.java.lang.NullPointerException - If any of the provided source stream ids or zip function are null.ZipCompositionFunction