### javax.script

# Interface Invocable

Known Implementing Classes:
  PhpFacesScriptEngine, PhpScriptEngine

`public interface Invocable`

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

Authors:
  Nandika Jayawardana <nandika@opensource.lk>
  Sanka Samaranayake <sanka@opensource.lk>

## 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`

`invoke(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.

`java.lang.Object`

`invoke(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.

## Method Details

### getInterface

    public 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

### getInterface

    public 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

### invoke

    public java.lang.Object invoke(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:
>   `thiz` - object on which the procedure is called
>   `methodName` - name of the procedure to be invoked
>   `args` - arguments set for the procedure

> Returns:
>   resultant object after the execution of the procedure

> Throws:
>   `ScriptException` - if the invocation of the procedure fails

### invoke

    public java.lang.Object invoke(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