public final class ReactiveTypeDescriptor extends Object
isMultiValue()
, isNoValue()
, and supportsEmpty()
.Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
Object |
getEmptyValue()
Return an empty-value instance for the underlying reactive or async type.
|
Class<?> |
getReactiveType()
Return the reactive type for this descriptor.
|
int |
hashCode() |
boolean |
isDeferred()
Whether the underlying operation is deferred and needs to be started
explicitly, e.g.
|
boolean |
isMultiValue()
Return
true if the reactive type can produce more than 1 value
can be produced and is therefore a good fit to adapt to Flux . |
boolean |
isNoValue()
Return
true if the reactive type does not produce any values and
only provides completion and error signals. |
static ReactiveTypeDescriptor |
multiValue(Class<?> type,
Supplier<?> emptySupplier)
Descriptor for a reactive type that can produce
0..N values. |
static ReactiveTypeDescriptor |
nonDeferredAsyncValue(Class<?> type,
Supplier<?> emptySupplier)
The same as
singleOptionalValue(Class, Supplier) but for a
non-deferred, async type such as CompletableFuture . |
static ReactiveTypeDescriptor |
noValue(Class<?> type,
Supplier<?> emptySupplier)
Descriptor for a reactive type that does not produce any values.
|
static ReactiveTypeDescriptor |
singleOptionalValue(Class<?> type,
Supplier<?> emptySupplier)
Descriptor for a reactive type that can produce 0..1 values.
|
static ReactiveTypeDescriptor |
singleRequiredValue(Class<?> type)
Descriptor for a reactive type that must produce 1 value to complete.
|
boolean |
supportsEmpty()
Return
true if the reactive type can complete with no values. |
public Class<?> getReactiveType()
public boolean isMultiValue()
true
if the reactive type can produce more than 1 value
can be produced and is therefore a good fit to adapt to Flux
.
A false
return value implies the reactive type can produce 1
value at most and is therefore a good fit to adapt to Mono
.public boolean isNoValue()
true
if the reactive type does not produce any values and
only provides completion and error signals.public boolean supportsEmpty()
true
if the reactive type can complete with no values.public Object getEmptyValue()
Use of this type implies supportsEmpty()
is true
.
public boolean isDeferred()
public static ReactiveTypeDescriptor multiValue(Class<?> type, Supplier<?> emptySupplier)
0..N
values.type
- the reactive typeemptySupplier
- a supplier of an empty-value instance of the reactive typepublic static ReactiveTypeDescriptor singleOptionalValue(Class<?> type, Supplier<?> emptySupplier)
type
- the reactive typeemptySupplier
- a supplier of an empty-value instance of the reactive typepublic static ReactiveTypeDescriptor singleRequiredValue(Class<?> type)
type
- the reactive typepublic static ReactiveTypeDescriptor noValue(Class<?> type, Supplier<?> emptySupplier)
type
- the reactive typeemptySupplier
- a supplier of an empty-value instance of the reactive typepublic static ReactiveTypeDescriptor nonDeferredAsyncValue(Class<?> type, Supplier<?> emptySupplier)
singleOptionalValue(Class, Supplier)
but for a
non-deferred, async type such as CompletableFuture
.type
- the reactive typeemptySupplier
- a supplier of an empty-value instance of the reactive type