Package com.arcadedb.function.java
Class JavaMethodFunctionDefinition
- java.lang.Object
-
- com.arcadedb.function.java.JavaMethodFunctionDefinition
-
- All Implemented Interfaces:
FunctionDefinition
public class JavaMethodFunctionDefinition extends Object implements FunctionDefinition
Maps a Java method execution to a callable function.- Author:
- Luca Garulli ([email protected])
-
-
Constructor Summary
Constructors Constructor Description JavaMethodFunctionDefinition(Object instance, Method method)
Creates a function bound to a Java method.JavaMethodFunctionDefinition(Method method)
Creates a function bound to a static Java method.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
execute(Object... parameters)
Executes the function passing optional parameters.Object
getInstance()
Returns the current java object instance to use for method calling.String
getName()
Returns the name of the function.
-
-
-
Constructor Detail
-
JavaMethodFunctionDefinition
public JavaMethodFunctionDefinition(Object instance, Method method) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException
Creates a function bound to a Java method.- Parameters:
instance
- Java object against where to invoke the methodmethod
- Java Method object to invoke- Throws:
NoSuchMethodException
InvocationTargetException
InstantiationException
IllegalAccessException
-
JavaMethodFunctionDefinition
public JavaMethodFunctionDefinition(Method method) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException
Creates a function bound to a static Java method.- Parameters:
method
- static method to execute- Throws:
NoSuchMethodException
InvocationTargetException
InstantiationException
IllegalAccessException
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:FunctionDefinition
Returns the name of the function.- Specified by:
getName
in interfaceFunctionDefinition
-
execute
public Object execute(Object... parameters)
Description copied from interface:FunctionDefinition
Executes the function passing optional parameters.- Specified by:
execute
in interfaceFunctionDefinition
- Parameters:
parameters
- are optional and can be positional or a map of key/value pairs.- Returns:
- The result of the function
-
getInstance
public Object getInstance()
Returns the current java object instance to use for method calling. If the instance is null, then the method is static.
-
-