Package com.arcadedb.function.java
Class JavaClassFunctionLibraryDefinition
- java.lang.Object
-
- com.arcadedb.function.java.JavaClassFunctionLibraryDefinition
-
- All Implemented Interfaces:
FunctionLibraryDefinition<JavaMethodFunctionDefinition>
public class JavaClassFunctionLibraryDefinition extends Object implements FunctionLibraryDefinition<JavaMethodFunctionDefinition>
Binds a Java class into a function library, where each method of the class are invokable functions. At construction time, the class is inspected to find the methods by using reflection This library definition implementation does not allow dynamic function registration.- Author:
- Luca Garulli ([email protected])
-
-
Constructor Summary
Constructors Constructor Description JavaClassFunctionLibraryDefinition(String javaFullClassName)
JavaClassFunctionLibraryDefinition(String libraryName, Class<?> impl)
JavaClassFunctionLibraryDefinition(String libraryName, String javaFullClassName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JavaMethodFunctionDefinition
getFunction(String functionName)
Returns a function by its nameIterable<JavaMethodFunctionDefinition>
getFunctions()
Returns an iterable of the defined functions.String
getName()
Returns the name of the library.boolean
hasFunction(String functionName)
Returns true if the function was defined, otherwise false.JavaClassFunctionLibraryDefinition
registerFunction(JavaMethodFunctionDefinition registerFunction)
Registers a new function in the library.JavaClassFunctionLibraryDefinition
unregisterFunction(String functionName)
Unregister a function from the library by its name.
-
-
-
Constructor Detail
-
JavaClassFunctionLibraryDefinition
public JavaClassFunctionLibraryDefinition(String javaFullClassName) throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException
-
JavaClassFunctionLibraryDefinition
public JavaClassFunctionLibraryDefinition(String libraryName, String javaFullClassName) throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException
-
JavaClassFunctionLibraryDefinition
public JavaClassFunctionLibraryDefinition(String libraryName, Class<?> impl) throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:FunctionLibraryDefinition
Returns the name of the library.- Specified by:
getName
in interfaceFunctionLibraryDefinition<JavaMethodFunctionDefinition>
-
getFunctions
public Iterable<JavaMethodFunctionDefinition> getFunctions()
Description copied from interface:FunctionLibraryDefinition
Returns an iterable of the defined functions.- Specified by:
getFunctions
in interfaceFunctionLibraryDefinition<JavaMethodFunctionDefinition>
-
hasFunction
public boolean hasFunction(String functionName)
Description copied from interface:FunctionLibraryDefinition
Returns true if the function was defined, otherwise false.- Specified by:
hasFunction
in interfaceFunctionLibraryDefinition<JavaMethodFunctionDefinition>
- Parameters:
functionName
- Name of the function to look up to
-
getFunction
public JavaMethodFunctionDefinition getFunction(String functionName) throws IllegalArgumentException
Description copied from interface:FunctionLibraryDefinition
Returns a function by its name- Specified by:
getFunction
in interfaceFunctionLibraryDefinition<JavaMethodFunctionDefinition>
- Parameters:
functionName
- Name of the function to retrieve- Throws:
IllegalArgumentException
- If the function was not defined
-
registerFunction
public JavaClassFunctionLibraryDefinition registerFunction(JavaMethodFunctionDefinition registerFunction)
Description copied from interface:FunctionLibraryDefinition
Registers a new function in the library.- Specified by:
registerFunction
in interfaceFunctionLibraryDefinition<JavaMethodFunctionDefinition>
- Parameters:
registerFunction
- function object to register
-
unregisterFunction
public JavaClassFunctionLibraryDefinition unregisterFunction(String functionName)
Description copied from interface:FunctionLibraryDefinition
Unregister a function from the library by its name.- Specified by:
unregisterFunction
in interfaceFunctionLibraryDefinition<JavaMethodFunctionDefinition>
- Parameters:
functionName
- Name of the function to unregister
-
-