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 StringdiscoverBeanDefinitionNameByQualifier(org.springframework.beans.factory.ListableBeanFactory beanFactory, String qualifier) static MethoddiscoverFunctionalMethod(Class<?> pojoFunctionClass) Will attempt to discover functional methods on the class.static TypediscoverFunctionType(Object function, String functionName, org.springframework.context.support.GenericApplicationContext applicationContext) static TypediscoverFunctionTypeFromClass(Class<?> functionalClass) static TypediscoverFunctionTypeFromFunctionMethod(Method functionMethod) static TypegetGenericType(Type type) A convenience method identical togetImmediateGenericType(Type, int)for cases when provided 'type' isPublisherorMessage.static TypegetImmediateGenericType(Type type, int index) static intgetInputCount(Type functionType) static TypegetInputType(Type functionType) Returns input type of function type that represents Function or Consumer.static intgetOutputCount(Type functionType) static TypegetOutputType(Type functionType) static Class<?>getRawType(Type type) Effectively convertsTypewhich could beParameterizedTypeto raw Class (no generics).static booleanisCollectionOfMessage(Type type) static booleanisConsumer(Type type) static booleanstatic booleanisFunction(Type type) static booleanisJsonNode(Type type) static booleanstatic booleanstatic booleanisMultipleArgumentType(Type type) static booleanisOutputArray(Type functionType) Determines if input argument to a Function is an array.static booleanisPublisher(Type type) static booleanisSupplier(Type type) static booleanisTypeArray(Type type) static booleanisTypeCollection(Type type) Will return 'true' if the provided type is aCollectiontype.static boolean
-
Method Details
-
isTypeCollection
Will return 'true' if the provided type is aCollectiontype. 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' isPublisherorMessage.- Parameters:
type- type to interrogate- Returns:
- generic type if possible otherwise the same type as provided
-
getRawType
Effectively convertsTypewhich could beParameterizedTypeto 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
-