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
- Author:
- David Turanski, John Blum
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intgetAnnotationParameterPosition(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 givenGemfireFunctionannotated POJOMethod.static booleanisGemfireFunction(Method method) static booleanisMatchingGemfireFunction(Method method, String functionId) Determines whether the givenMethodis a POJO,GemfireFunctionannotatedMethodhaving an ID matching the givenfunctionId.static voidregisterFunctionForPojoMethod(Class<?> type, String functionId) Bind amethodwith the givenFunction IDon an object of the giventypeas aFunctionand register it with theFunctionService.static voidregisterFunctionForPojoMethod(Object target, Method method, boolean overwrite) static voidregisterFunctionForPojoMethod(Object target, Method method, AnnotationAttributes gemfireFunctionAttributes, boolean overwrite) Wrap thetarget objectandmethodin a GemFire/GeodeFunctionand register theFunctionwith theFunctionService.static voidregisterFunctionForPojoMethod(Object target, String functionId) Bind amethodwith the givenFunction IDon the giventargetas aFunctionand register it with theFunctionService.
-
Constructor Details
-
GemfireFunctionUtils
public GemfireFunctionUtils()
-
-
Method Details
-
isGemfireFunction
- Parameters:
method-Methodto evaluate.- Returns:
- a boolean value indicating whether the
Methodon a POJO represents a SDGGemfireFunction. - See Also:
-
isMatchingGemfireFunction
Determines whether the givenMethodis a POJO,GemfireFunctionannotatedMethodhaving an ID matching the givenfunctionId. -
getGemfireFunctionId
Null-safe operation used to determine the GemFire/GeodeFunction.getId()Function ID} of a givenGemfireFunctionannotated POJOMethod. If theMethodis not null and annotated withGemfireFunctionthen 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-GemfireFunctionannotated POJOMethodcontaining the implementation of the GemFire/GeodeFunction.- Returns:
- the GemFire/Geode
Function IDof the givenMethod, or an emptyOptionalif theMethodis not a GemFire/GeodeFunction. - See Also:
-
registerFunctionForPojoMethod
Bind amethodwith the givenFunction IDon an object of the giventypeas aFunctionand register it with theFunctionService.- Parameters:
type-target typeto evaluate; must not be null.functionId-Stringcontaining theFunction.getId()identifying theMethodon thetarget typeto bind as aFunction.- Throws:
IllegalArgumentException- iftypeis null.- See Also:
-
registerFunctionForPojoMethod
Bind amethodwith the givenFunction IDon the giventargetas aFunctionand register it with theFunctionService.- Parameters:
target-target objectto evaluate; must not be null.functionId-Stringcontaining theFunction.getId()identifying theMethodon thetarget objectto bind as aFunction.- Throws:
IllegalArgumentException- iftargetis null.- See Also:
-
registerFunctionForPojoMethod
- Parameters:
target-target objectto evaluate; must not be null.method-Methodontargetbound as aFunction.overwrite- if true, will replace any existingFunctionhaving the sameID.- Throws:
IllegalArgumentException- iftargetis null or the givenMethodis not aGemfireFunction.- See Also:
-
registerFunctionForPojoMethod
public static void registerFunctionForPojoMethod(Object target, Method method, AnnotationAttributes gemfireFunctionAttributes, boolean overwrite) Wrap thetarget objectandmethodin a GemFire/GeodeFunctionand register theFunctionwith theFunctionService.- Parameters:
target-target object.method-Methodbound to aFunction.gemfireFunctionAttributes-GemfireFunctionannotation attributes.overwrite- if true, will replace any existingFunctionhaving 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- theMethodinstancetargetAnnotationType- the annotationrequiredTypes- an array of valid parameter types for the annotation- Returns:
- the parameter position or -1 if the annotated parameter is not found
-