Class ReactiveStreamsPublisherAdapter
java.lang.Object
org.apache.juneau.rest.server.reactive.reactor.ReactiveStreamsPublisherAdapter
- All Implemented Interfaces:
ReactiveStreamsAdapter
Catch-all
ReactiveStreamsAdapter for any
Reactive-Streams
org.reactivestreams.Publisher<T> that is not already
handled by a more specific adapter.
Converts to a JDK Flow.Publisher via
FlowAdapters.toFlowPublisher(Publisher) and renders it as a stream.
Registered last so library-specific single-value types (Reactor Mono, which also
implements Publisher) are matched by their own adapter first.
- Since:
- 10.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConverts the supplied reactive value to a JDK-nativeAdaptation.booleanReturns whether this adapter recognizes the supplied return value.
-
Constructor Details
-
ReactiveStreamsPublisherAdapter
public ReactiveStreamsPublisherAdapter()
-
-
Method Details
-
canAdapt
Description copied from interface:ReactiveStreamsAdapterReturns whether this adapter recognizes the supplied return value.Implementations must return
false(rather than throw) for values they do not handle, and must be cheap to call — this is invoked on the response hot path for every non-null handler return value once at least one adapter is registered.- Specified by:
canAdaptin interfaceReactiveStreamsAdapter- Parameters:
value- The@RestOphandler return value. Nevernull.- Returns:
trueifReactiveStreamsAdapter.adapt(Object)can convert this value.
-
adapt
Description copied from interface:ReactiveStreamsAdapterConverts the supplied reactive value to a JDK-nativeAdaptation.Only called when
ReactiveStreamsAdapter.canAdapt(Object)returnedtruefor the same value.- Specified by:
adaptin interfaceReactiveStreamsAdapter- Parameters:
value- The reactive value to adapt. Nevernull.- Returns:
- The adapted single-value or streaming shape. Never
null.
-