org.springframework.core

Class ReactiveTypeDescriptor

  • java.lang.Object
    • org.springframework.core.ReactiveTypeDescriptor


  • public final class ReactiveTypeDescriptor
    extends java.lang.Object
    Describes the semantics of a reactive type including boolean checks for isMultiValue(), supportsEmpty(), and isNoValue().
    Since:
    5.0
    Author:
    Rossen Stoyanchev
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      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.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getReactiveType

        public java.lang.Class<?> getReactiveType()
        Return the reactive type for this descriptor.
      • isMultiValue

        public 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. A false return value implies the reactive type can produce 1 value at most and is therefore a good fit to adapt to Mono.
      • supportsEmpty

        public boolean supportsEmpty()
        Return true if the reactive type can complete with no values.
      • isNoValue

        public boolean isNoValue()
        Return true if the reactive type does not produce any values and only provides completion and error signals.
      • getEmptyValue

        public java.lang.Object getEmptyValue()
        Return an empty-value instance for the underlying reactive or async type. Use of this type implies supportsEmpty() is true.
      • equals

        public boolean equals(@Nullable
                              java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • multiValue

        public static ReactiveTypeDescriptor multiValue(java.lang.Class<?> type,
                                                        java.util.function.Supplier<?> emptySupplier)
        Descriptor for a reactive type that can produce 0..N values.
        Parameters:
        type - the reactive type
        emptySupplier - a supplier of an empty-value instance of the reactive type
      • singleOptionalValue

        public static ReactiveTypeDescriptor singleOptionalValue(java.lang.Class<?> type,
                                                                 java.util.function.Supplier<?> emptySupplier)
        Descriptor for a reactive type that can produce 0..1 values.
        Parameters:
        type - the reactive type
        emptySupplier - a supplier of an empty-value instance of the reactive type
      • singleRequiredValue

        public static ReactiveTypeDescriptor singleRequiredValue(java.lang.Class<?> type)
        Descriptor for a reactive type that must produce 1 value to complete.
        Parameters:
        type - the reactive type
      • noValue

        public static ReactiveTypeDescriptor noValue(java.lang.Class<?> type,
                                                     java.util.function.Supplier<?> emptySupplier)
        Descriptor for a reactive type that does not produce any values.
        Parameters:
        type - the reactive type
        emptySupplier - a supplier of an empty-value instance of the reactive type