Class Adaptation
java.lang.Object
org.apache.juneau.rest.server.reactive.Adaptation
The result of a
ReactiveStreamsAdapter.adapt(...) call:
either a single-value CompletionStage or a multi-value
Flow.Publisher.
Exactly one of the two shapes is present. Single-value adaptations (e.g. Reactor Mono,
RxJava Single / Maybe) collapse onto the existing CompletableFuture async
response path. Streaming adaptations (e.g. Reactor Flux, RxJava Flowable /
Observable, a Reactive-Streams Publisher) are subscribed to and rendered as a
buffered list, an SSE stream, or an NDJSON stream depending on the negotiated response media type.
- Since:
- 10.0.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanisStream()Returns whether this adaptation is a multi-value stream (vs. a single value).single()Returns the single-value completion stage, ornullif this is a streaming adaptation.static Adaptationsingle(CompletionStage<?> value) Creates a single-value adaptation backed by aCompletionStage.stream()Returns the streaming publisher, ornullif this is a single-value adaptation.static Adaptationstream(Flow.Publisher<?> value) Creates a streaming adaptation backed by aFlow.Publisher.
-
Method Details
-
single
Creates a single-value adaptation backed by aCompletionStage.- Parameters:
value- The completion stage. Must not benull.- Returns:
- A new adaptation.
-
stream
Creates a streaming adaptation backed by aFlow.Publisher.- Parameters:
value- The publisher. Must not benull.- Returns:
- A new adaptation.
-
isStream
Returns whether this adaptation is a multi-value stream (vs. a single value).- Returns:
trueif this is aFlow.Publisheradaptation.
-
single
Returns the single-value completion stage, ornullif this is a streaming adaptation.- Returns:
- The completion stage, or
null.
-
stream
Returns the streaming publisher, ornullif this is a single-value adaptation.- Returns:
- The publisher, or
null.
-