With many script engines, you can invoke a function in the scripting language without having to evaluate the actual script code. This is useful if you allow users to implement a service in a scripting language of their choice.
The script engines that offer this functionality implement the
Invocable interface. In particular, the Rhino engine implements
To call a function, call the
invokeFunction method with the function name, followed by the function parameters:
if (engine implements Invocable) ((Invocable) engine).invokeFunction("aFunction", param1, param2);
If the scripting language is object-oriented, you call can a method like this:
((Invocable) engine).invokeMethod(implicitParam, ...