Package org.codehaus.commons.compiler.jdk

# Class ScriptEvaluator

java.lang.Object
org.codehaus.commons.compiler.Cookable
org.codehaus.commons.compiler.MultiCookable
org.codehaus.commons.compiler.jdk.ScriptEvaluator

All Implemented Interfaces:
  `ICookable`, `IMultiCookable`, `IScriptEvaluator`

public class ScriptEvaluator extends MultiCookable implements IScriptEvaluator
To set up a `ScriptEvaluator` object, proceed as described for `IScriptEvaluator`. Alternatively, a number of "convenience constructors" exist that execute the described steps instantly.

Alternatively, a number of "convenience constructors" exist that execute the steps described above instantly. Their use is discouraged.

Notice that this implementation of `IClassBodyEvaluator` is prone to "Java injection", i.e. an application could get more than one class body compiled by passing a bogus input document.

Also notice that the parsing of leading IMPORT declarations is heuristic and has certain limitations; see `ClassBodyEvaluator.parseImportDeclarations(Reader)`.

## Field Summary

### Fields inherited from interface org.codehaus.commons.compiler.IScriptEvaluator

`DEFAULT_METHOD_NAME, DEFAULT_RETURN_TYPE`

## Constructor Summary

Constructors
Constructor
Description
`ScriptEvaluator()`
`ScriptEvaluator(String script)`
Equivalent to
`ScriptEvaluator(String fileName, InputStream is, Class<?> returnType, String[] parameterNames, Class<?>[] parameterTypes, Class<?>[] thrownExceptions, ClassLoader parentClassLoader)`
Equivalent to
`ScriptEvaluator(String fileName, Reader reader, Class<?> returnType, String[] parameterNames, Class<?>[] parameterTypes, Class<?>[] thrownExceptions, ClassLoader parentClassLoader)`
Equivalent to
`ScriptEvaluator(String script, Class<?> returnType)`
Equivalent to
`ScriptEvaluator(String script, Class<?> returnType, String[] parameterNames, Class<?>[] parameterTypes)`
Equivalent to
`ScriptEvaluator(String script, Class<?> returnType, String[] parameterNames, Class<?>[] parameterTypes, Class<?>[] thrownExceptions)`
Equivalent to

## Method Summary

Modifier and Type
Method
Description
`void`
`cook(String[] fileNames, Reader[] readers)`
Same as `Cookable.cook(String, Reader)`, but cooks a set of documents into one class.
`protected final void`
`cook(String[] fileNames, Reader[] readers, String[] imports)`
`void`
`cook(String fileName, Reader reader)`
Reads, scans, parses and compiles Java tokens from the given `Reader`.
`<T> T`
`createFastEvaluator(Reader r, Class<T> interfaceToImplement, String[] parameterNames)`
If the parameter and return types of the expression are known at compile time, then a "fast" script evaluator can be instantiated through this method.
`<T> T`
`createFastEvaluator(String script, Class<T> interfaceToImplement, String[] parameterNames)`
`Object`
`evaluate()`
Shorthand for `evaluate``(new Object[0])`.
`Object`
`evaluate(int idx, Object[] arguments)`
Same as `IScriptEvaluator.evaluate(Object[])`, but for multiple scripts.
`Object`
`evaluate(Object[] arguments)`
Calls the script with concrete parameter values.
`Map<String,byte[]>`
`getBytecodes()`
`Class<?>`
`getClazz()`
`String[]`
`getDefaultImports()`
`Class<?>`
`getDefaultReturnType()`
`Method`
`getMethod()`
`Method`
`getMethod(int idx)`
Same as `IScriptEvaluator.getMethod()`, but for multiple scripts.
`protected Method[]`
`getMethods()`
`Method[]`
`getResult()`
`protected final Class<?>`
`getReturnType(int i)`
`void`
`setClassName(String className)`
`void`
`setCompileErrorHandler(ErrorHandler compileErrorHandler)`
Installs an `ErrorHandler` which is invoked during compilation on each error.
`void`
`setDebuggingInformation(boolean debugSource, boolean debugLines, boolean debugVars)`
Determines what kind of debugging information is included in the generates classes.
`void`
`setDefaultImports(String... defaultImports)`
`void`
`setDefaultReturnType(Class<?> defaultReturnType)`
When this `IScriptEvaluator` is coooked, then the defaultReturnType applies to all scripts for which no explicit return type was configured.
`void`
`setExtendedClass(Class<?> extendedClass)`
`void`
`setImplementedInterfaces(Class<?>[] implementedInterfaces)`
`void`
`setMethodName(String methodName)`
Defines the name of the generated method.
`void`
`setMethodNames(String[] methodNames)`
Same as `IScriptEvaluator.setMethodName(String)`, but for multiple scripts.
`void`
`setOverrideMethod(boolean overrideMethod)`
Defines whether the generated method overrides a methods declared in a supertype.
`void`
`setOverrideMethod(boolean[] overrideMethod)`
Same as `IScriptEvaluator.setOverrideMethod(boolean)`, but for multiple scripts.
`void`
`setParameters(String[][] parameterNames, Class<?>[][] parameterTypes)`
Same as `IScriptEvaluator.setParameters(String[], Class[])`, but for multiple scripts.
`void`
`setParameters(String[] names, Class<?>[] types)`
Defines the names and types of the parameters of the generated method.
`void`
`setParentClassLoader(ClassLoader parentClassLoader)`
The "parent class loader" is used to load referenced classes.
`void`
`setReturnType(Class<?> returnType)`
Defines the return type of the generated method.
`void`
`setReturnTypes(Class<?>[] returnTypes)`
Configures the return types of the generated methods.
`void`
`setScriptCount(int count)`
`void`
`setSourceVersion(int version)`
Specifies the version of source code accepted, in analogy with JAVAC's `-source` command line option.
`void`
`setStaticMethod(boolean staticMethod)`
Defines whether the generated method should be STATIC or not.
`void`
`setStaticMethod(boolean[] staticMethod)`
Same as `IScriptEvaluator.setStaticMethod(boolean)`, but for multiple scripts.
`void`
`setTargetVersion(int version)`
Generates class files that target a specified release of the virtual machine, in analogy with JAVAC's `-target` command line option.
`void`
`setThrownExceptions(Class<?>[] thrownExceptions)`
Defines the exceptions that the generated method may throw.
`void`
`setThrownExceptions(Class<?>[][] thrownExceptions)`
Same as `IScriptEvaluator.setThrownExceptions(Class[])`, but for multiple scripts.
`void`
`setWarningHandler(WarningHandler warningHandler)`
By default, warnings are discarded, but an application my install a custom `WarningHandler`.

### Methods inherited from class org.codehaus.commons.compiler.MultiCookable

`cook, cook, cook, cook, cook, cook, cook, cookFiles, cookFiles, cookFiles, cookFiles`

### Methods inherited from class org.codehaus.commons.compiler.Cookable

`cook, cook, cook, cook, cook, cook, cook, cookFile, cookFile, cookFile, cookFile`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.codehaus.commons.compiler.ICookable

`cook, cook, cook, cook, cook, cook, cook, cookFile, cookFile, cookFile, cookFile`

### Methods inherited from interface org.codehaus.commons.compiler.IMultiCookable

`cook, cook, cook, cook, cookFiles, cookFiles, cookFiles, cookFiles`

### Methods inherited from interface org.codehaus.commons.compiler.IScriptEvaluator

`cook, cook, cook`

## Constructor Details

### ScriptEvaluator

public ScriptEvaluator(String script) throws CompileException
Equivalent to

         ScriptEvaluator se = new ScriptEvaluator();
         se.cook(script);

Throws:
  `CompileException`
See Also:
  - `ScriptEvaluator()`
  - `Cookable.cook(String)`

### ScriptEvaluator

public ScriptEvaluator(String script, Class<?> returnType) throws CompileException
Equivalent to

         ScriptEvaluator se = new ScriptEvaluator();
         se.setReturnType(returnType);
         se.cook(script);

Throws:
  `CompileException`
See Also:
  - `ScriptEvaluator()`
  - `setReturnType(Class)`
  - `Cookable.cook(String)`

### ScriptEvaluator

public ScriptEvaluator(String script, Class<?> returnType, String[] parameterNames, Class<?>[] parameterTypes) throws CompileException
Equivalent to

         ScriptEvaluator se = new ScriptEvaluator();
         se.setReturnType(returnType);
         se.setParameters(parameterNames, parameterTypes);
         se.cook(script);

Throws:
  `CompileException`
See Also:
  - `ScriptEvaluator()`
  - `setReturnType(Class)`
  - `setParameters(String[], Class[])`
  - `Cookable.cook(String)`

### ScriptEvaluator

public ScriptEvaluator(String script, Class<?> returnType, String[] parameterNames, Class<?>[] parameterTypes, Class<?>[] thrownExceptions) throws CompileException
Equivalent to

         ScriptEvaluator se = new ScriptEvaluator();
         se.setReturnType(returnType);
         se.setParameters(parameterNames, parameterTypes);
         se.setThrownExceptions(thrownExceptions);
         se.cook(script);

Throws:
  `CompileException`
See Also:
  - `ScriptEvaluator()`
  - `setReturnType(Class)`
  - `setParameters(String[], Class[])`
  - `setThrownExceptions(Class[])`
  - `Cookable.cook(String)`

### ScriptEvaluator

public ScriptEvaluator(@Nullable String fileName, InputStream is, Class<?> returnType, String[] parameterNames, Class<?>[] parameterTypes, Class<?>[] thrownExceptions, @Nullable ClassLoader parentClassLoader) throws CompileException, IOException
Equivalent to

         ScriptEvaluator se = new ScriptEvaluator();
         se.setReturnType(returnType);
         se.setParameters(parameterNames, parameterTypes);
         se.setThrownExceptions(thrownExceptions);
         se.setParentClassLoader(parentClassLoader);
         se.cook(fileName, is);

Parameters:
  `parentClassLoader` - `null` means use current thread's context class loader
Throws:
  `CompileException`
  `IOException`
See Also:
  - `ScriptEvaluator()`
  - `setReturnType(Class)`
  - `setParameters(String[], Class[])`
  - `setThrownExceptions(Class[])`
  - `SimpleCompiler.setParentClassLoader(ClassLoader)`
  - `Cookable.cook(String, InputStream)`

### ScriptEvaluator

public ScriptEvaluator(@Nullable String fileName, Reader reader, Class<?> returnType, String[] parameterNames, Class<?>[] parameterTypes, Class<?>[] thrownExceptions, @Nullable ClassLoader parentClassLoader) throws CompileException, IOException
Equivalent to

         ScriptEvaluator se = new ScriptEvaluator();
         se.setReturnType(returnType);
         se.setParameters(parameterNames, parameterTypes);
         se.setThrownExceptions(thrownExceptions);
         se.setParentClassLoader(parentClassLoader);
         se.cook(reader);

Parameters:
  `parentClassLoader` - `null` means use current thread's context class loader
Throws:
  `CompileException`
  `IOException`
See Also:
  - `ScriptEvaluator()`
  - `setReturnType(Class)`
  - `setParameters(String[], Class[])`
  - `setThrownExceptions(Class[])`
  - `SimpleCompiler.setParentClassLoader(ClassLoader)`
  - `Cookable.cook(String, Reader)`

### ScriptEvaluator

public ScriptEvaluator()

## Method Details

### setParentClassLoader

public void setParentClassLoader(@Nullable ClassLoader parentClassLoader)
Description copied from interface: `IScriptEvaluator`
The "parent class loader" is used to load referenced classes. Useful values are:

`System.getSystemClassLoader()` | The running JVM's class path
`Thread.currentThread().getContextClassLoader()` or `null` | The class loader effective for the invoking thread
`ClassLoaders.BOOTCLASSPATH_CLASS_LOADER` | The running JVM's boot class path

The parent class loader defaults to the current thread's context class loader.

Specified by:
  `setParentClassLoader` in interface `IScriptEvaluator`

### setDebuggingInformation

public void setDebuggingInformation(boolean debugSource, boolean debugLines, boolean debugVars)
Description copied from interface: `IScriptEvaluator`
Determines what kind of debugging information is included in the generates classes. The default is typically "`-g:none`".

Specified by:
  `setDebuggingInformation` in interface `IScriptEvaluator`

### setSourceVersion

public void setSourceVersion(int version)
Description copied from interface: `ICookable`
Specifies the version of source code accepted, in analogy with JAVAC's `-source` command line option. May be ignored by an implementation (e.g. the `janino` implementation always accepts the language features as described on the home page). Allowed values, and the default value, depend on the implementation. `-1` means to use a default version.

Specified by:
  `setSourceVersion` in interface `ICookable`

### setTargetVersion

public void setTargetVersion(int version)
Description copied from interface: `ICookable`
Generates class files that target a specified release of the virtual machine, in analogy with JAVAC's `-target` command line option. Allowed values depend on the implementation. The default value also depends on the implementation. The only invariant is that the generated class files are suitable for the currently executing JVM. `-1` means to use a default version.

Specified by:
  `setTargetVersion` in interface `ICookable`

### setCompileErrorHandler

public void setCompileErrorHandler(@Nullable ErrorHandler compileErrorHandler)
Description copied from interface: `IScriptEvaluator`
Installs an `ErrorHandler` which is invoked during compilation on each error. (By default, the compilation throws a `CompileException` on the first error and terminates.)

If the given `ErrorHandler` throws a `CompileException`, then the compilation terminates and the exception is propagated.

If the given `ErrorHandler` does not throw a `CompileException` but completes normally, then the compilation may or may not continue, depending on the error. Iff the compilation completes normally but errors were reported, then it will throw a `CompileException` indicating the number of errors.

In other words: The `ErrorHandler` may throw a `CompileException` or not, but the compilation will definitely throw a `CompileException` if one or more compile errors have occurred.

Specified by:
  `setCompileErrorHandler` in interface `IScriptEvaluator`
Parameters:
  `compileErrorHandler` - `null` to restore the default behavior (throwing a `CompileException`)

### setWarningHandler

public void setWarningHandler(@Nullable WarningHandler warningHandler)
Description copied from interface: `IScriptEvaluator`
By default, warnings are discarded, but an application my install a custom `WarningHandler`.

Specified by:
  `setWarningHandler` in interface `IScriptEvaluator`
Parameters:
  `warningHandler` - `null` to indicate that no warnings be issued

### setScriptCount

public void setScriptCount(int count)

Throws:
  `IllegalArgumentException` - count is different from previous invocations of this method

### setClassName

public void setClassName(String className)

Specified by:
  `setClassName` in interface `IScriptEvaluator`
See Also:
  - `IClassBodyEvaluator.setClassName(String)`

### setImplementedInterfaces

public void setImplementedInterfaces(Class<?>[] implementedInterfaces)

Specified by:
  `setImplementedInterfaces` in interface `IScriptEvaluator`
See Also:
  - `IClassBodyEvaluator.setImplementedInterfaces(Class[])`

### setExtendedClass

public void setExtendedClass(@Nullable Class<?> extendedClass)

Specified by:
  `setExtendedClass` in interface `IScriptEvaluator`
See Also:
  - `IClassBodyEvaluator.setExtendedClass(Class)`

### setDefaultReturnType

public void setDefaultReturnType(Class<?> defaultReturnType)
Description copied from interface: `IScriptEvaluator`
When this `IScriptEvaluator` is coooked, then the defaultReturnType applies to all scripts for which no explicit return type was configured.

The initial default return type (if you want, the "default-default" return type) is `void.class`.

Specified by:
  `setDefaultReturnType` in interface `IScriptEvaluator`
See Also:
  - `IScriptEvaluator.setReturnType(Class)`
  - `IScriptEvaluator.setReturnTypes(Class[])`

### getDefaultReturnType

public Class<?> getDefaultReturnType()

Specified by:
  `getDefaultReturnType` in interface `IScriptEvaluator`
Returns:
  The default return type that was previously configured with `IScriptEvaluator.setDefaultReturnType(Class)`, or `IScriptEvaluator.DEFAULT_RETURN_TYPE`

### setDefaultImports

public void setDefaultImports(String... defaultImports)

Specified by:
  `setDefaultImports` in interface `IScriptEvaluator`
See Also:
  - `IClassBodyEvaluator.setDefaultImports(String...)`

### getDefaultImports

public String[] getDefaultImports()

Specified by:
  `getDefaultImports` in interface `IScriptEvaluator`
See Also:
  - `IClassBodyEvaluator.getDefaultImports()`

### setOverrideMethod

public void setOverrideMethod(boolean overrideMethod)
Description copied from interface: `IScriptEvaluator`
Defines whether the generated method overrides a methods declared in a supertype.

Specified by:
  `setOverrideMethod` in interface `IScriptEvaluator`

### setStaticMethod

public void setStaticMethod(boolean staticMethod)
Description copied from interface: `IScriptEvaluator`
Defines whether the generated method should be STATIC or not. Defaults to `true`.

Specified by:
  `setStaticMethod` in interface `IScriptEvaluator`

### setReturnType

public void setReturnType(Class<?> returnType)
Description copied from interface: `IScriptEvaluator`
Defines the return type of the generated method. Value `null` means "use the default return type".

Specified by:
  `setReturnType` in interface `IScriptEvaluator`
See Also:
  - `IScriptEvaluator.setDefaultReturnType(Class)`

### setMethodName

public void setMethodName(@Nullable String methodName)
Description copied from interface: `IScriptEvaluator`
Defines the name of the generated method. Initially, the method name is "eval*".

Specified by:
  `setMethodName` in interface `IScriptEvaluator`
Parameters:
  `methodName` - `null` means reset to default name
See Also:
  - `IScriptEvaluator.DEFAULT_METHOD_NAME`

### setParameters

public void setParameters(String[] names, Class<?>[] types)
Description copied from interface: `IScriptEvaluator`
Defines the names and types of the parameters of the generated method.

names`.length` and types`.length` must be equal. This invariant may be checked immediately, or later when the script is cooked.

The parameters can be of primitive type, e.g. `double.class`.

The default is to have zero parameters.

Specified by:
  `setParameters` in interface `IScriptEvaluator`

### setThrownExceptions

public void setThrownExceptions(Class<?>[] thrownExceptions)
Description copied from interface: `IScriptEvaluator`
Defines the exceptions that the generated method may throw.

Specified by:
  `setThrownExceptions` in interface `IScriptEvaluator`

### evaluate

@Nullable public Object evaluate() throws InvocationTargetException
Description copied from interface: `IScriptEvaluator`
Shorthand for `evaluate``(new Object[0])`.

Specified by:
  `evaluate` in interface `IScriptEvaluator`
Throws:
  `InvocationTargetException`

### evaluate

@Nullable public Object evaluate(@Nullable Object[] arguments) throws InvocationTargetException
Description copied from interface: `IScriptEvaluator`
Calls the script with concrete parameter values.

Each argument must have the same type as specified through the `parameterTypes` parameter of `IScriptEvaluator.setParameters(String[], Class[])`.

Arguments of primitive type must passed with their wrapper class objects.

The object returned has the class as specified through `IScriptEvaluator.setReturnType(Class)`.

This method is thread-safe.

Notice: In version 3.1.8, the arguments parameter was changed from `Object[]` to `Object...`, which turned out to be a really bad decision because it caused a very ugly invocation ambiguity with `IScriptEvaluator.evaluate(int, Object[])`. Thus, with version 3.1.10, the parameter was changed back to `Object[]`.

Specified by:
  `evaluate` in interface `IScriptEvaluator`
Parameters:
  `arguments` - The actual parameter values
Throws:
  `InvocationTargetException`

### getMethod

public Method getMethod()

Specified by:
  `getMethod` in interface `IScriptEvaluator`
Returns:
  The generated and loaded `Method`

### setOverrideMethod

public void setOverrideMethod(boolean[] overrideMethod)
Description copied from interface: `IScriptEvaluator`
Same as `IScriptEvaluator.setOverrideMethod(boolean)`, but for multiple scripts.

Specified by:
  `setOverrideMethod` in interface `IScriptEvaluator`

### setStaticMethod

public void setStaticMethod(boolean[] staticMethod)
Description copied from interface: `IScriptEvaluator`
Same as `IScriptEvaluator.setStaticMethod(boolean)`, but for multiple scripts.

Specified by:
  `setStaticMethod` in interface `IScriptEvaluator`

### setReturnTypes

public void setReturnTypes(Class<?>[] returnTypes)
Description copied from interface: `IScriptEvaluator`
Configures the return types of the generated methods. If an element of the array is `null`, then use the "default return type" for that script.

Specified by:
  `setReturnTypes` in interface `IScriptEvaluator`
Parameters:
  `returnTypes` - The methods' return types; `null` elements mean "use the default return type"
See Also:
  - `IScriptEvaluator.setDefaultReturnType(Class)`
  - `IScriptEvaluator.getDefaultReturnType()`

### setMethodNames

public void setMethodNames(String[] methodNames)
Description copied from interface: `IScriptEvaluator`
Same as `IScriptEvaluator.setMethodName(String)`, but for multiple scripts.

Define the names of the generated methods. By default the methods have distinct and implementation-specific names.

If two scripts have the same name, then they must have different parameter types (see `IScriptEvaluator.setParameters(String[][], Class[][])`).

Specified by:
  `setMethodNames` in interface `IScriptEvaluator`

### setParameters

public void setParameters(String[][] parameterNames, Class<?>[][] parameterTypes)
Description copied from interface: `IScriptEvaluator`
Same as `IScriptEvaluator.setParameters(String[], Class[])`, but for multiple scripts.

Specified by:
  `setParameters` in interface `IScriptEvaluator`

### setThrownExceptions

public void setThrownExceptions(Class<?>[][] thrownExceptions)
Description copied from interface: `IScriptEvaluator`
Same as `IScriptEvaluator.setThrownExceptions(Class[])`, but for multiple scripts.

Specified by:
  `setThrownExceptions` in interface `IScriptEvaluator`

### cook

public void cook(@Nullable String fileName, Reader reader) throws CompileException, IOException
Description copied from interface: `ICookable`
Reads, scans, parses and compiles Java tokens from the given `Reader`.

Specified by:
  `cook` in interface `ICookable`
Specified by:
  `cook` in class `Cookable`
Parameters:
  `fileName` - Used when reporting errors and warnings
Throws:
  `CompileException`
  `IOException`

### cook

public void cook(String[] fileNames, Reader[] readers) throws CompileException, IOException
Description copied from interface: `IMultiCookable`
Same as `Cookable.cook(String, Reader)`, but cooks a set of documents into one class. Notice that if any of the documents causes trouble, the entire compilation will fail. If you need to report which of the documents causes the exception, you may want to use the `fileNames` parameter to distinguish between the individual token sources.

Specified by:
  `cook` in interface `IMultiCookable`
Specified by:
  `cook` in interface `IScriptEvaluator`
Specified by:
  `cook` in class `MultiCookable`
Throws:
  `CompileException`
  `IOException`

### cook

protected final void cook(String[] fileNames, Reader[] readers, String[] imports) throws CompileException, IOException

Parameters:
  `readers` - The scripts to cook
Throws:
  `CompileException`
  `IOException`

### getReturnType

protected final Class<?> getReturnType(int i)

Returns:
  The return type of the ith script

### createFastEvaluator

public <T> T createFastEvaluator(String script, Class<T> interfaceToImplement, String[] parameterNames) throws CompileException

Specified by:
  `createFastEvaluator` in interface `IScriptEvaluator`
Parameters:
  `script` - Contains the sequence of script tokens
Throws:
  `CompileException`
See Also:
  - `createFastEvaluator(String, Class, String[])`

### createFastEvaluator

public <T> T createFastEvaluator(Reader r, Class<T> interfaceToImplement, String[] parameterNames) throws CompileException, IOException
Description copied from interface: `IScriptEvaluator`
If the parameter and return types of the expression are known at compile time, then a "fast" script evaluator can be instantiated through this method.

Script evaluation is faster than through `IScriptEvaluator.evaluate(Object[])`, because it is not done through reflection but through direct method invocation.

Example:

     public interface Foo {
         int bar(int a, int b);
     }
     ...
     IScriptEvaluator se = CompilerFactoryFactory.getDefaultCompilerFactory().newScriptEvaluator();

     // Optionally configure the SE her:
     se.setClassName("Bar");
     se.setDefaultImports(new String[] { "java.util.*" });
     se.setExtendedClass(SomeOtherClass.class);
     se.setParentClassLoader(someClassLoader);

     Foo f = (Foo) se.createFastScriptEvaluator(
         "return a - b;",
         Foo.class,
         new String[] { "a", "b" }
     );
     System.out.println("1 - 2 = " + f.bar(1, 2));

All other configuration (implemented type, static method, return type, method name, parameter names and types, thrown exceptions) are predetermined by the `interfaceToImplement`.

Notice: The `interfaceToImplement` must either be declared `public`, or with package scope in the same package as the generated class (see `IScriptEvaluator.setClassName(String)`).

s

Specified by:
  `createFastEvaluator` in interface `IScriptEvaluator`
Parameters:
  `r` - Produces the stream of script tokens
  `interfaceToImplement` - Must declare exactly one method
  `parameterNames` - The names of the parameters of that method
Returns:
  An object that implements the given interface
Throws:
  `CompileException`
  `IOException`

### evaluate

@Nullable public Object evaluate(int idx, @Nullable Object[] arguments) throws InvocationTargetException
Description copied from interface: `IScriptEvaluator`
Same as `IScriptEvaluator.evaluate(Object[])`, but for multiple scripts.

Specified by:
  `evaluate` in interface `IScriptEvaluator`
Throws:
  `InvocationTargetException`

### getResult

public Method[] getResult()

Specified by:
  `getResult` in interface `IScriptEvaluator`
Returns:
  The generated and loaded methods that implement the cooked scripts

### getMethod

public Method getMethod(int idx)
Description copied from interface: `IScriptEvaluator`
Same as `IScriptEvaluator.getMethod()`, but for multiple scripts.

Specified by:
  `getMethod` in interface `IScriptEvaluator`

### getMethods

protected Method[] getMethods()

Throws:
  `IllegalStateException` - This `ScriptEvaluator` has not yet been `cook()`ed

### getClazz

public Class<?> getClazz()

Specified by:
  `getClazz` in interface `IScriptEvaluator`
See Also:
  - `IClassBodyEvaluator.getClazz()`

### getBytecodes

public Map<String,byte[]> getBytecodes()

Specified by:
  `getBytecodes` in interface `ICookable`
Returns:
  The generated Java bytecode; maps class name to bytes