Class FunctionTypeUtils
java.lang.Object
org.springframework.cloud.function.context.catalog.FunctionTypeUtils
Set of utility operations to interrogate function definitions.
- Since:
- 3.0
- Author:
- Oleg Zhurakousky, Andrey Shlykov
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
discoverBeanDefinitionNameByQualifier
(org.springframework.beans.factory.ListableBeanFactory beanFactory, String qualifier) static Method
discoverFunctionalMethod
(Class<?> pojoFunctionClass) Will attempt to discover functional methods on the class.static Type
discoverFunctionType
(Object function, String functionName, org.springframework.context.support.GenericApplicationContext applicationContext) static Type
discoverFunctionTypeFromClass
(Class<?> functionalClass) static Type
discoverFunctionTypeFromFunctionMethod
(Method functionMethod) static Type
getGenericType
(Type type) A convenience method identical togetImmediateGenericType(Type, int)
for cases when provided 'type' isPublisher
orMessage
.static Type
getImmediateGenericType
(Type type, int index) static int
getInputCount
(Type functionType) static Type
getInputType
(Type functionType) Returns input type of function type that represents Function or Consumer.static int
getOutputCount
(Type functionType) static Type
getOutputType
(Type functionType) static Class<?>
getRawType
(Type type) Effectively convertsType
which could beParameterizedType
to raw Class (no generics).static boolean
isCollectionOfMessage
(Type type) static boolean
isConsumer
(Type type) static boolean
static boolean
isFunction
(Type type) static boolean
isJsonNode
(Type type) static boolean
static boolean
static boolean
isMultipleArgumentType
(Type type) static boolean
isOutputArray
(Type functionType) Determines if input argument to a Function is an array.static boolean
isPublisher
(Type type) static boolean
isSupplier
(Type type) static boolean
isTypeArray
(Type type) static boolean
isTypeCollection
(Type type) Will return 'true' if the provided type is aCollection
type.static boolean
-
Method Details
-
isTypeCollection
Will return 'true' if the provided type is aCollection
type. This also includes collections wrapped inMessage
. For example, If provided type isMessage<List<Foo>>
this operation will return 'true'.- Parameters:
type
- type to interrogate- Returns:
- 'true' if this type represents a
Collection
. Otherwise 'false'.
-
isTypeMap
-
isTypeArray
-
isJsonNode
-
getGenericType
A convenience method identical togetImmediateGenericType(Type, int)
for cases when provided 'type' isPublisher
orMessage
.- Parameters:
type
- type to interrogate- Returns:
- generic type if possible otherwise the same type as provided
-
getRawType
Effectively convertsType
which could beParameterizedType
to raw Class (no generics). -
discoverFunctionalMethod
Will attempt to discover functional methods on the class. It's applicable for POJOs as well as functional classes in `java.util.function` package. For the later the names of the methods are well known (`apply`, `accept` and `get`). For the former it will attempt to discover a single method following semantics described in (seeFunctionalInterface
)- Parameters:
pojoFunctionClass
- the class to introspect- Returns:
- functional method
-
discoverFunctionTypeFromClass
-
discoverFunctionTypeFromFunctionMethod
-
getInputCount
-
getOutputCount
-
getInputType
Returns input type of function type that represents Function or Consumer.- Parameters:
functionType
- the Type of Function or Consumer- Returns:
- the input type as
Type
-
discoverFunctionType
-
discoverBeanDefinitionNameByQualifier
-
getOutputType
-
getImmediateGenericType
-
isPublisher
-
isFlux
-
isCollectionOfMessage
-
isMessage
-
isOutputArray
Determines if input argument to a Function is an array.- Parameters:
functionType
- the function type- Returns:
- true if input type is an array, otherwise false
-
isSupplier
-
isFunction
-
isConsumer
-
isMono
-
isMultipleArgumentType
-