Class GemfireFunctionUtils
java.lang.Object
org.springframework.data.gemfire.function.GemfireFunctionUtils
Utility class for registering a POJO as a GemFire/Geode
Function
.- Since:
- 1.2.0
- See Also:
-
Function
FunctionService
GemfireFunction
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
getAnnotationParameterPosition
(Method method, Class<?> targetAnnotationType, Class<?>[] requiredTypes) Determine the order position of a an annotated method parametergetGemfireFunctionId
(Method method) Null-safe operation used to determine the GemFire/GeodeFunction.getId()
Function ID} of a givenGemfireFunction
annotated POJOMethod
.static boolean
isGemfireFunction
(Method method) static boolean
isMatchingGemfireFunction
(Method method, String functionId) Determines whether the givenMethod
is a POJO,GemfireFunction
annotatedMethod
having an ID matching the givenfunctionId
.static void
registerFunctionForPojoMethod
(Class<?> type, String functionId) static void
registerFunctionForPojoMethod
(Object target, Method method, boolean overwrite) static void
registerFunctionForPojoMethod
(Object target, Method method, org.springframework.core.annotation.AnnotationAttributes gemfireFunctionAttributes, boolean overwrite) Wrap thetarget object
andmethod
in a GemFire/GeodeFunction
and register theFunction
with theFunctionService
.static void
registerFunctionForPojoMethod
(Object target, String functionId)
-
Constructor Details
-
GemfireFunctionUtils
public GemfireFunctionUtils()
-
-
Method Details
-
isGemfireFunction
- Parameters:
method
-Method
to evaluate.- Returns:
- a boolean value indicating whether the
Method
on a POJO represents a SDGGemfireFunction
. - See Also:
-
isMatchingGemfireFunction
Determines whether the givenMethod
is a POJO,GemfireFunction
annotatedMethod
having an ID matching the givenfunctionId
.- Parameters:
method
-Method
to evaluate.functionId
-String
containing theID
to match.- Returns:
- a boolean indicating whether the given
Method
is a POJO,GemfireFunction
annotatedMethod
with the givenfunctionId
. - See Also:
-
getGemfireFunctionId
Null-safe operation used to determine the GemFire/GeodeFunction.getId()
Function ID} of a givenGemfireFunction
annotated POJOMethod
. If theMethod
is not null and annotated withGemfireFunction
then this method tries to determine theFunction.getId()
from theGemfireFunction.id()
attribute. If theGemfireFunction.id()
attribute was not explicitly set, then theMethod.getName()
is returned as theFunction ID
.- Parameters:
method
-GemfireFunction
annotated POJOMethod
containing the implementation of the GemFire/GeodeFunction
.- Returns:
- the GemFire/Geode
Function ID
of the givenMethod
, or an emptyOptional
if theMethod
is not a GemFire/GeodeFunction
. - See Also:
-
registerFunctionForPojoMethod
Bind amethod
with the givenFunction ID
on an object of the giventype
as aFunction
and register it with theFunctionService
.- Parameters:
type
-target type
to evaluate; must not be null.functionId
-String
containing theFunction.getId()
identifying theMethod
on thetarget type
to bind as aFunction
.- Throws:
IllegalArgumentException
- iftype
is null.- See Also:
-
registerFunctionForPojoMethod
Bind amethod
with the givenFunction ID
on the giventarget
as aFunction
and register it with theFunctionService
.- Parameters:
target
-target object
to evaluate; must not be null.functionId
-String
containing theFunction.getId()
identifying theMethod
on thetarget object
to bind as aFunction
.- Throws:
IllegalArgumentException
- iftarget
is null.- See Also:
-
registerFunctionForPojoMethod
- Parameters:
target
-target object
to evaluate; must not be null.method
-Method
ontarget
bound as aFunction
.overwrite
- if true, will replace any existingFunction
having the sameID
.- Throws:
IllegalArgumentException
- iftarget
is null or the givenMethod
is not aGemfireFunction
.- See Also:
-
registerFunctionForPojoMethod
public static void registerFunctionForPojoMethod(Object target, Method method, org.springframework.core.annotation.AnnotationAttributes gemfireFunctionAttributes, boolean overwrite) Wrap thetarget object
andmethod
in a GemFire/GeodeFunction
and register theFunction
with theFunctionService
.- Parameters:
target
-target object
.method
-Method
bound to aFunction
.gemfireFunctionAttributes
-GemfireFunction
annotation attributes
.overwrite
- if true, will replace any existingFunction
having the same ID.
-
getAnnotationParameterPosition
public static int getAnnotationParameterPosition(Method method, Class<?> targetAnnotationType, Class<?>[] requiredTypes) Determine the order position of a an annotated method parameter- Parameters:
method
- theMethod
instancetargetAnnotationType
- the annotationrequiredTypes
- an array of valid parameter types for the annotation- Returns:
- the parameter position or -1 if the annotated parameter is not found
-