public class FunctionsDefinitions
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
void |
addFunction(java.lang.String name,
java.lang.Object obj,
java.lang.reflect.Method method)
Add a new binding.
|
Function |
getFunction(FunctionKey key)
Return the function of a given key.
|
java.util.Map<FunctionKey,Function> |
getFunctions()
Return the Map of functions.
|
static FunctionsDefinitions |
getInstance()
Return the unique instance.
|
static boolean |
isVarargs(java.lang.String functionName) |
void |
reset()
Reset all the bindings.
|
public static FunctionsDefinitions getInstance()
public void reset()
public java.util.Map<FunctionKey,Function> getFunctions()
public static boolean isVarargs(java.lang.String functionName)
public Function getFunction(FunctionKey key)
key
- the function keypublic void addFunction(java.lang.String name, java.lang.Object obj, java.lang.reflect.Method method)
FunctionsDefinitions def = FunctionsDefinitions.getInstance(); Method method = ExprFunctionTest.class.getMethod("myTest", Integer.TYPE, Integer.TYPE); def.addFunction("test", this, method);For the function with the following signature:
public int myTest(int a, int b) { return a + b; }The function can then be called as for example:
test(1, 2)
name
- the name of the function (to be used in the expressions)obj
- the object holding the associated Java methodmethod
- the Java methodCopyright © 2018 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence