Package com.arcadedb.function.polyglot
Class PolyglotFunctionLibraryDefinition<T extends PolyglotFunctionDefinition>
- java.lang.Object
-
- com.arcadedb.function.polyglot.PolyglotFunctionLibraryDefinition<T>
-
- All Implemented Interfaces:
FunctionLibraryDefinition<T>
- Direct Known Subclasses:
JavascriptFunctionLibraryDefinition
public abstract class PolyglotFunctionLibraryDefinition<T extends PolyglotFunctionDefinition> extends Object implements FunctionLibraryDefinition<T>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
PolyglotFunctionLibraryDefinition.Callback
-
Field Summary
Fields Modifier and Type Field Description protected List<String>
allowedPackages
protected Database
database
protected ConcurrentMap<String,T>
functions
protected String
language
protected String
libraryName
protected GraalPolyglotEngine
polyglotEngine
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
execute(PolyglotFunctionLibraryDefinition.Callback callback)
T
getFunction(String functionName)
Returns a function by its nameIterable<T>
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.PolyglotFunctionLibraryDefinition
registerFunction(T function)
Registers a new function in the library.PolyglotFunctionLibraryDefinition
unregisterFunction(String functionName)
Unregister a function from the library by its name.
-
-
-
Field Detail
-
database
protected final Database database
-
libraryName
protected final String libraryName
-
language
protected final String language
-
functions
protected final ConcurrentMap<String,T extends PolyglotFunctionDefinition> functions
-
polyglotEngine
protected GraalPolyglotEngine polyglotEngine
-
-
Method Detail
-
registerFunction
public PolyglotFunctionLibraryDefinition registerFunction(T function)
Description copied from interface:FunctionLibraryDefinition
Registers a new function in the library.- Specified by:
registerFunction
in interfaceFunctionLibraryDefinition<T extends PolyglotFunctionDefinition>
- Parameters:
function
- function object to register
-
unregisterFunction
public PolyglotFunctionLibraryDefinition unregisterFunction(String functionName)
Description copied from interface:FunctionLibraryDefinition
Unregister a function from the library by its name.- Specified by:
unregisterFunction
in interfaceFunctionLibraryDefinition<T extends PolyglotFunctionDefinition>
- Parameters:
functionName
- Name of the function to unregister
-
getName
public String getName()
Description copied from interface:FunctionLibraryDefinition
Returns the name of the library.- Specified by:
getName
in interfaceFunctionLibraryDefinition<T extends PolyglotFunctionDefinition>
-
getFunctions
public Iterable<T> getFunctions()
Description copied from interface:FunctionLibraryDefinition
Returns an iterable of the defined functions.- Specified by:
getFunctions
in interfaceFunctionLibraryDefinition<T extends PolyglotFunctionDefinition>
-
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<T extends PolyglotFunctionDefinition>
- Parameters:
functionName
- Name of the function to look up to
-
getFunction
public T getFunction(String functionName)
Description copied from interface:FunctionLibraryDefinition
Returns a function by its name- Specified by:
getFunction
in interfaceFunctionLibraryDefinition<T extends PolyglotFunctionDefinition>
- Parameters:
functionName
- Name of the function to retrieve
-
execute
public Object execute(PolyglotFunctionLibraryDefinition.Callback callback)
-
-