public final class ReactiveTypeDescriptor
extends java.lang.Object
isMultiValue()
, isNoValue()
, and supportsEmpty()
.Modifier and Type | Field and Description |
---|---|
private java.util.function.Supplier<?> |
emptyValueSupplier |
private boolean |
multiValue |
private boolean |
noValue |
private java.lang.Class<?> |
reactiveType |
Modifier | Constructor and Description |
---|---|
private |
ReactiveTypeDescriptor(java.lang.Class<?> reactiveType,
boolean multiValue,
boolean noValue,
java.util.function.Supplier<?> emptySupplier)
Private constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object other) |
java.lang.Object |
getEmptyValue()
Return an empty-value instance for the underlying reactive or async type.
|
java.lang.Class<?> |
getReactiveType()
Return the reactive type for this descriptor.
|
int |
hashCode() |
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(java.lang.Class<?> type,
java.util.function.Supplier<?> emptySupplier)
Descriptor for a reactive type that can produce 0..N values.
|
static ReactiveTypeDescriptor |
noValue(java.lang.Class<?> type,
java.util.function.Supplier<?> emptySupplier)
Descriptor for a reactive type that does not produce any values.
|
static ReactiveTypeDescriptor |
singleOptionalValue(java.lang.Class<?> type,
java.util.function.Supplier<?> emptySupplier)
Descriptor for a reactive type that can produce 0..1 values.
|
static ReactiveTypeDescriptor |
singleRequiredValue(java.lang.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. |
private final java.lang.Class<?> reactiveType
private final boolean multiValue
private final boolean noValue
@Nullable private final java.util.function.Supplier<?> emptyValueSupplier
private ReactiveTypeDescriptor(java.lang.Class<?> reactiveType, boolean multiValue, boolean noValue, @Nullable java.util.function.Supplier<?> emptySupplier)
public java.lang.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 java.lang.Object getEmptyValue()
supportsEmpty()
is true.public boolean equals(@Nullable java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public static ReactiveTypeDescriptor multiValue(java.lang.Class<?> type, java.util.function.Supplier<?> emptySupplier)
type
- the reactive typeemptySupplier
- a supplier of an empty-value instance of the reactive typepublic static ReactiveTypeDescriptor singleOptionalValue(java.lang.Class<?> type, java.util.function.Supplier<?> emptySupplier)
type
- the reactive typeemptySupplier
- a supplier of an empty-value instance of the reactive typepublic static ReactiveTypeDescriptor singleRequiredValue(java.lang.Class<?> type)
type
- the reactive typepublic static ReactiveTypeDescriptor noValue(java.lang.Class<?> type, java.util.function.Supplier<?> emptySupplier)
type
- the reactive typeemptySupplier
- a supplier of an empty-value instance of the reactive type