javax.script
Interface Invocable

All Known Implementing Classes:
InteractivePhpScriptEngine, InvocablePhpScriptEngine

public interface Invocable

The Invocable interface (optional) contains methods which allow the Java application to invoke intermediate codes in the underlying scripting interpreter.

Author:
Nandika Jayawardana , Sanka Samaranayake

Method Summary
 java.lang.Object getInterface(java.lang.Class clasz)
          Retrieves an instance of java class whose methods are impelemented using procedures in script which are in the intermediate code repository in the underlying interpreter.
 java.lang.Object getInterface(java.lang.Object thiz, java.lang.Class clasz)
          Retrieves an instance of java class whose methods are impelemented using procedures in script which are in the intermediate code repository in the underlying interpreter.
 java.lang.Object invokeFunction(java.lang.String methodName, java.lang.Object[] args)
          Invokes a scripting procedure with the given name using the array of objects as its arguments set.
 java.lang.Object invokeMethod(java.lang.Object thiz, java.lang.String methodName, java.lang.Object[] args)
          Invokes a procedure on an object which already defined in the script using the array of objects as its arguments set.
 

Method Detail

invokeFunction

java.lang.Object invokeFunction(java.lang.String methodName,
                                java.lang.Object[] args)
                                throws ScriptException,
                                       java.lang.NoSuchMethodException
Invokes a scripting procedure with the given name using the array of objects as its arguments set.

Parameters:
methodName - name of the scripting procedure
args - arguments set for the scripting procedure
Returns:
resultant object after the execution of the procedure
Throws:
ScriptException - if the invocation of the scripting procedure fails
java.lang.NoSuchMethodException

invokeMethod

java.lang.Object invokeMethod(java.lang.Object thiz,
                              java.lang.String methodName,
                              java.lang.Object[] args)
                              throws ScriptException,
                                     java.lang.NoSuchMethodException
Invokes a procedure on an object which already defined in the script using the array of objects as its arguments set.

Parameters:
methodName - name of the procedure to be invoked
thiz - object on which the procedure is called
args - arguments set for the procedure
Returns:
resultant object after the execution of the procedure
Throws:
ScriptException - if the invocation of the procedure fails
java.lang.NoSuchMethodException

getInterface

java.lang.Object getInterface(java.lang.Object thiz,
                              java.lang.Class clasz)
Retrieves an instance of java class whose methods are impelemented using procedures in script which are in the intermediate code repository in the underlying interpreter.

Parameters:
thiz - object on which the procedure is called
clasz - an interface which the returned class must implement
Returns:
an instance of the class which implement the specified interface

getInterface

java.lang.Object getInterface(java.lang.Class clasz)
Retrieves an instance of java class whose methods are impelemented using procedures in script which are in the intermediate code repository in the underlying interpreter.

Parameters:
clasz - an interface which the returned class must implement
Returns:
an instance of the class which implement the specified interface