I'm not sure that there is a real interest in trying to implement the
Invocable interface. It is an optional feature, I think we can leave it
aside for now.


  Claude

On Sat, 16 Jun 2012 21:03:34 +0530
Dishara Wijewardana <[email protected]> wrote:

> Hi all,
> 
> May I know what is the API/methods used to call from Velocity classes
> to call the defined methods/functions in a velocity script.
> In  JSR 223 there is a class called Invocable. Appreciate any links
> to go through and understand.
> 
> In case I have not made this clear, let me give a example code block
> in JSR223 compliant implementation(i.e groovy.)
> 
> ScriptEngineManager factory = new ScriptEngineManager(); ScriptEngine
> engine = factory.getEngineByName("groovy"); String script = "def
> adder(a,b) {return a+b }"; engine.eval(script); *Invocable inv =
> (Invocable) engine;*Object[] params = {
> new Integer(5),new Integer(3) };
> Object result = *inv.invokeFunction(**"adder"**, params)*;
> 
> which will be result in 8 .
> 
> Thanks
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to