public class ReactiveAdapter
extends java.lang.Object
Publisher to and from an async/reactive type
such as CompletableFuture, an RxJava Observable, etc.
Use the ReactiveAdapterRegistry to register reactive types and
obtain adapters from.
| Constructor and Description |
|---|
ReactiveAdapter(ReactiveTypeDescriptor descriptor,
java.util.function.Function<java.lang.Object,org.reactivestreams.Publisher<?>> toPublisherFunction,
java.util.function.Function<org.reactivestreams.Publisher<?>,java.lang.Object> fromPublisherFunction)
Constructor for an adapter with functions to convert the target reactive
or async type to and from a Reactive Streams Publisher.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
fromPublisher(org.reactivestreams.Publisher<?> publisher)
Adapt from the given Reactive Streams Publisher.
|
ReactiveTypeDescriptor |
getDescriptor()
Return the descriptor of the reactive type for the adapter.
|
java.lang.Class<?> |
getReactiveType()
A shortcut for
getDescriptor().getReactiveType(). |
boolean |
isMultiValue()
A shortcut for
getDescriptor().isMultiValue(). |
boolean |
isNoValue()
A shortcut for
getDescriptor().isNoValue(). |
boolean |
supportsEmpty()
A shortcut for
getDescriptor().supportsEmpty(). |
<T> org.reactivestreams.Publisher<T> |
toPublisher(java.lang.Object source)
Adapt the given instance to a Reactive Streams Publisher.
|
public ReactiveAdapter(ReactiveTypeDescriptor descriptor, java.util.function.Function<java.lang.Object,org.reactivestreams.Publisher<?>> toPublisherFunction, java.util.function.Function<org.reactivestreams.Publisher<?>,java.lang.Object> fromPublisherFunction)
descriptor - the reactive type descriptortoPublisherFunction - adapter to a PublisherfromPublisherFunction - adapter from a Publisherpublic ReactiveTypeDescriptor getDescriptor()
public java.lang.Class<?> getReactiveType()
getDescriptor().getReactiveType().public boolean isMultiValue()
getDescriptor().isMultiValue().public boolean supportsEmpty()
getDescriptor().supportsEmpty().public boolean isNoValue()
getDescriptor().isNoValue().public <T> org.reactivestreams.Publisher<T> toPublisher(@Nullable java.lang.Object source)
source - the source object to adapt frompublic java.lang.Object fromPublisher(org.reactivestreams.Publisher<?> publisher)
publisher - the publisher to adapt from