Class ScriptEvaluator
- All Implemented Interfaces:
IClassBodyEvaluator
,ICookable
,IScriptEvaluator
,ISimpleCompiler
- Direct Known Subclasses:
ExpressionEvaluator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String[]
protected boolean[]
Whether methods override a method declared by a supertype;null
means "none".protected String[][]
protected Class[][]
protected Class[]
The methods' return types;null
means "none".protected boolean[]
Whether methods are static;null
means "all".protected Class[][]
Fields inherited from class org.codehaus.janino.ClassBodyEvaluator
className, ZERO_CLASSES
Fields inherited from class org.codehaus.janino.SimpleCompiler
debugLines, debugSource, debugVars
Fields inherited from interface org.codehaus.commons.compiler.IClassBodyEvaluator
DEFAULT_CLASS_NAME
Fields inherited from interface org.codehaus.commons.compiler.ICookable
BOOT_CLASS_LOADER, SYSTEM_PROPERTY_SOURCE_DEBUGGING_DIR, SYSTEM_PROPERTY_SOURCE_DEBUGGING_ENABLE
-
Constructor Summary
ConstructorsConstructorDescriptionScriptEvaluator
(String script) Equivalent toScriptEvaluator
(String optionalFileName, InputStream is, Class returnType, String[] parameterNames, Class[] parameterTypes, Class[] thrownExceptions, ClassLoader optionalParentClassLoader) Equivalent toScriptEvaluator
(String optionalFileName, Reader reader, Class returnType, String[] parameterNames, Class[] parameterTypes, Class[] thrownExceptions, ClassLoader optionalParentClassLoader) Equivalent toScriptEvaluator
(String script, Class returnType) Equivalent toScriptEvaluator
(String script, Class returnType, String[] parameterNames, Class[] parameterTypes) Equivalent toScriptEvaluator
(String script, Class returnType, String[] parameterNames, Class[] parameterTypes, Class[] thrownExceptions) Equivalent toScriptEvaluator
(Scanner scanner, Class optionalExtendedType, Class[] implementedTypes, Class returnType, String[] parameterNames, Class[] parameterTypes, Class[] thrownExceptions, ClassLoader optionalParentClassLoader) Equivalent toScriptEvaluator
(Scanner scanner, Class returnType, String[] parameterNames, Class[] parameterTypes, Class[] thrownExceptions, ClassLoader optionalParentClassLoader) Equivalent toScriptEvaluator
(Scanner scanner, String className, Class optionalExtendedType, Class[] implementedTypes, boolean staticMethod, Class returnType, String methodName, String[] parameterNames, Class[] parameterTypes, Class[] thrownExceptions, ClassLoader optionalParentClassLoader) Equivalent to -
Method Summary
Modifier and TypeMethodDescriptionprotected void
compileToMethods
(Java.CompilationUnit compilationUnit, String[] methodNames, Class[][] parameterTypes) final void
Same asICookable.cook(Reader)
, but for multiple scripts.final void
Same asICookable.cook(String)
, but for multiple scripts.final void
On a 2 GHz Intel Pentium Core Duo under Windows XP with an IBM 1.4.2 JDK, compiling 10000 expressions "a + b" (integer) takes about 4 seconds and 56 MB of main memory.final void
Same asICookable.cook(String, String)
, but for multiple scripts.final void
final void
Scans, parses and ompiles a given compilation unit from the given scanner.final void
Likecook(Scanner)
, but cooks a set of scripts into one class.createFastEvaluator
(Reader reader, Class 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.createFastEvaluator
(String script, Class interfaceToImplement, String[] parameterNames) createFastEvaluator
(Scanner scanner, Class interfaceToImplement, String[] parameterNames) Notice: This method is not declared inIScriptEvaluator
, and is hence only available in this implementation oforg.codehaus.commons.compiler
.static Object
createFastScriptEvaluator
(String script, Class interfaceToImplement, String[] parameterNames) Deprecated.static Object
createFastScriptEvaluator
(Scanner scanner, Class interfaceToImplement, String[] parameterNames, ClassLoader optionalParentClassLoader) Deprecated.static Object
createFastScriptEvaluator
(Scanner scanner, String[] optionalDefaultImports, String className, Class optionalExtendedClass, Class interfaceToImplement, String[] parameterNames, ClassLoader optionalParentClassLoader) Deprecated.UsecreateFastEvaluator(Scanner,Class,String[])
instead:static Object
createFastScriptEvaluator
(Scanner scanner, String className, Class optionalExtendedType, Class interfaceToImplement, String[] parameterNames, ClassLoader optionalParentClassLoader) Deprecated.final Object
createInstance
(Reader reader) Don't use.Same asIScriptEvaluator.evaluate(Object[])
, but for multiple scripts.Calls the script with concrete parameter values.protected Class
Returns the loadedMethod
.getMethod
(int idx) Same asIScriptEvaluator.getMethod()
, but for multiple scripts.static String[]
guessParameterNames
(Scanner scanner) Guess the names of the parameters used in the given expression.protected Java.MethodDeclarator
makeMethodDeclaration
(Location location, Java.Annotation[] annotations, boolean staticMethod, Class returnType, String methodName, Class[] parameterTypes, String[] parameterNames, Class[] thrownExceptions, List statements) To the givenJava.ClassDeclaration
, add A public method declaration with the given return type, name, parameter names and values and thrown exceptions A blockprotected List
makeStatements
(int idx, Parser parser) Fill the givenblock
by parsing statements until EOF and adding them to the block.void
setMethodName
(String methodName) Define the name of the generated method.void
setMethodNames
(String[] methodNames) Same asIScriptEvaluator.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 asIScriptEvaluator.setOverrideMethod(boolean)
, but for multiple scripts.void
setParameters
(String[][] parameterNames, Class[][] parameterTypes) Same asIScriptEvaluator.setParameters(String[], Class[])
, but for multiple scripts.void
setParameters
(String[] parameterNames, Class[] parameterTypes) Define the names and types of the parameters of the generated method.void
setReturnType
(Class returnType) Defines the return type of the generated method.void
setReturnTypes
(Class[] returnTypes) Defines the return types of the generated methods.void
setStaticMethod
(boolean staticMethod) Define whether the generated method should be STATIC or not.void
setStaticMethod
(boolean[] staticMethod) Same asIScriptEvaluator.setStaticMethod(boolean)
, but for multiple scripts.void
setThrownExceptions
(Class[] thrownExceptions) Define the exceptions that the generated method may throw.void
setThrownExceptions
(Class[][] thrownExceptions) Same asIScriptEvaluator.setThrownExceptions(Class[])
, but for multiple scripts.Methods inherited from class org.codehaus.janino.ClassBodyEvaluator
addPackageMemberClassDeclaration, compileToClass, createFastClassBodyEvaluator, createFastClassBodyEvaluator, getClazz, makeCompilationUnit, setClassName, setDefaultImports, setExtendedClass, setExtendedType, setImplementedInterfaces, setImplementedTypes
Methods inherited from class org.codehaus.janino.SimpleCompiler
assertNotCooked, classesToTypes, classToType, compileToClassLoader, cook, cook, equals, getClassLoader, hashCode, main, setDebuggingInformation, setParentClassLoader
Methods inherited from class org.codehaus.commons.compiler.Cookable
cook, cook, cook, cook, cook, cook, cook, cookFile, cookFile, cookFile, cookFile, readString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.codehaus.commons.compiler.IClassBodyEvaluator
getClazz, setClassName, setDefaultImports, setExtendedClass, setExtendedType, setImplementedInterfaces, setImplementedTypes
-
Field Details
-
optionalOverrideMethod
protected boolean[] optionalOverrideMethodWhether methods override a method declared by a supertype;null
means "none". -
optionalStaticMethod
protected boolean[] optionalStaticMethodWhether methods are static;null
means "all". -
optionalReturnTypes
The methods' return types;null
means "none". -
optionalMethodNames
-
optionalParameterNames
-
optionalParameterTypes
-
optionalThrownExceptions
-
-
Constructor Details
-
ScriptEvaluator
Equivalent toScriptEvaluator se = new ScriptEvaluator(); se.cook(script);
- Throws:
CompileException
- See Also:
-
ScriptEvaluator
Equivalent toScriptEvaluator se = new ScriptEvaluator(); se.setReturnType(returnType); se.cook(script);
- Throws:
CompileException
- See Also:
-
ScriptEvaluator
public ScriptEvaluator(String script, Class returnType, String[] parameterNames, Class[] parameterTypes) throws CompileException Equivalent toScriptEvaluator se = new ScriptEvaluator(); se.setReturnType(returnType); se.setParameters(parameterNames, parameterTypes); se.cook(script);
-
ScriptEvaluator
public ScriptEvaluator(String script, Class returnType, String[] parameterNames, Class[] parameterTypes, Class[] thrownExceptions) throws CompileException Equivalent toScriptEvaluator se = new ScriptEvaluator(); se.setReturnType(returnType); se.setParameters(parameterNames, parameterTypes); se.setThrownExceptions(thrownExceptions); se.cook(script);
-
ScriptEvaluator
public ScriptEvaluator(String optionalFileName, InputStream is, Class returnType, String[] parameterNames, Class[] parameterTypes, Class[] thrownExceptions, ClassLoader optionalParentClassLoader) throws CompileException, IOException Equivalent toScriptEvaluator se = new ScriptEvaluator(); se.setReturnType(returnType); se.setParameters(parameterNames, parameterTypes); se.setThrownExceptions(thrownExceptions); se.setParentClassLoader(optionalParentClassLoader); se.cook(optionalFileName, is);
-
ScriptEvaluator
public ScriptEvaluator(String optionalFileName, Reader reader, Class returnType, String[] parameterNames, Class[] parameterTypes, Class[] thrownExceptions, ClassLoader optionalParentClassLoader) throws CompileException, IOException Equivalent toScriptEvaluator se = new ScriptEvaluator(); se.setReturnType(returnType); se.setParameters(parameterNames, parameterTypes); se.setThrownExceptions(thrownExceptions); se.setParentClassLoader(optionalParentClassLoader); se.cook(reader);
-
ScriptEvaluator
public ScriptEvaluator(Scanner scanner, Class returnType, String[] parameterNames, Class[] parameterTypes, Class[] thrownExceptions, ClassLoader optionalParentClassLoader) throws CompileException, IOException Equivalent toScriptEvaluator se = new ScriptEvaluator(); se.setReturnType(returnType); se.setParameters(parameterNames, parameterTypes); se.setThrownExceptions(thrownExceptions); se.setParentClassLoader(optionalParentClassLoader); se.cook(scanner);
-
ScriptEvaluator
public ScriptEvaluator(Scanner scanner, Class optionalExtendedType, Class[] implementedTypes, Class returnType, String[] parameterNames, Class[] parameterTypes, Class[] thrownExceptions, ClassLoader optionalParentClassLoader) throws CompileException, IOException Equivalent toScriptEvaluator se = new ScriptEvaluator(); se.setExtendedType(optionalExtendedType); se.setImplementedTypes(implementedTypes); se.setReturnType(returnType); se.setParameters(parameterNames, parameterTypes); se.setThrownExceptions(thrownExceptions); se.setParentClassLoader(optionalParentClassLoader); se.cook(scanner);
- Throws:
CompileException
IOException
- See Also:
-
ScriptEvaluator
public ScriptEvaluator(Scanner scanner, String className, Class optionalExtendedType, Class[] implementedTypes, boolean staticMethod, Class returnType, String methodName, String[] parameterNames, Class[] parameterTypes, Class[] thrownExceptions, ClassLoader optionalParentClassLoader) throws CompileException, IOException Equivalent toScriptEvaluator se = new ScriptEvaluator(); se.setClassName(className); se.setExtendedType(optionalExtendedType); se.setImplementedTypes(implementedTypes); se.setStaticMethod(staticMethod); se.setReturnType(returnType); se.setMethodName(methodName); se.setParameters(parameterNames, parameterTypes); se.setThrownExceptions(thrownExceptions); se.setParentClassLoader(optionalParentClassLoader); se.cook(scanner);
- Throws:
CompileException
IOException
- See Also:
-
ScriptEvaluator()
ClassBodyEvaluator.setClassName(String)
ClassBodyEvaluator.setExtendedClass(Class)
ClassBodyEvaluator.setImplementedInterfaces(Class[])
setStaticMethod(boolean)
setReturnType(Class)
setMethodName(String)
setParameters(String[], Class[])
setThrownExceptions(Class[])
SimpleCompiler.setParentClassLoader(ClassLoader)
Cookable.cook(Reader)
-
ScriptEvaluator
public ScriptEvaluator()
-
-
Method Details
-
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 interfaceIScriptEvaluator
-
setStaticMethod
public void setStaticMethod(boolean staticMethod) Description copied from interface:IScriptEvaluator
Define whether the generated method should be STATIC or not. Defaults totrue
.- Specified by:
setStaticMethod
in interfaceIScriptEvaluator
-
setReturnType
Description copied from interface:IScriptEvaluator
Defines the return type of the generated method. The meaning of anull
value is implementation-dependent.- Specified by:
setReturnType
in interfaceIScriptEvaluator
-
setMethodName
Description copied from interface:IScriptEvaluator
Define the name of the generated method. Defaults to an unspecified name.- Specified by:
setMethodName
in interfaceIScriptEvaluator
-
setParameters
Description copied from interface:IScriptEvaluator
Define the names and types of the parameters of the generated method.names
andtypes
must have the same number of elements.The parameters can be of primitive type, e.g.
double.class
.- Specified by:
setParameters
in interfaceIScriptEvaluator
-
setThrownExceptions
Description copied from interface:IScriptEvaluator
Define the exceptions that the generated method may throw.- Specified by:
setThrownExceptions
in interfaceIScriptEvaluator
-
cook
Description copied from class:SimpleCompiler
Scans, parses and ompiles a given compilation unit from the given scanner. After completion,SimpleCompiler.getClassLoader()
returns aClassLoader
that allows for access to the compiled classes.- Overrides:
cook
in classClassBodyEvaluator
- Throws:
CompileException
IOException
-
evaluate
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 ofIScriptEvaluator.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.
- Specified by:
evaluate
in interfaceIScriptEvaluator
- Parameters:
arguments
- The actual parameter values- Throws:
InvocationTargetException
-
getMethod
Description copied from interface:IScriptEvaluator
Returns the loadedMethod
.This method must only be called after exactly one of the
ICookable.cook(String, Reader)
methods was called.- Specified by:
getMethod
in interfaceIScriptEvaluator
-
setOverrideMethod
public void setOverrideMethod(boolean[] overrideMethod) Description copied from interface:IScriptEvaluator
Same asIScriptEvaluator.setOverrideMethod(boolean)
, but for multiple scripts.- Specified by:
setOverrideMethod
in interfaceIScriptEvaluator
-
setStaticMethod
public void setStaticMethod(boolean[] staticMethod) Description copied from interface:IScriptEvaluator
Same asIScriptEvaluator.setStaticMethod(boolean)
, but for multiple scripts.- Specified by:
setStaticMethod
in interfaceIScriptEvaluator
-
setReturnTypes
Defines the return types of the generated methods.- Specified by:
setReturnTypes
in interfaceIScriptEvaluator
- Parameters:
returnTypes
- The methods' return types;null
values mean the "default return type", which is the type returned bygetDefaultReturnType()
(void.class
forScriptEvaluator
andObject.class
forExpressionEvaluator
)- See Also:
-
setMethodNames
Description copied from interface:IScriptEvaluator
Same asIScriptEvaluator.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 interfaceIScriptEvaluator
-
setParameters
Description copied from interface:IScriptEvaluator
Same asIScriptEvaluator.setParameters(String[], Class[])
, but for multiple scripts.- Specified by:
setParameters
in interfaceIScriptEvaluator
-
setThrownExceptions
Description copied from interface:IScriptEvaluator
Same asIScriptEvaluator.setThrownExceptions(Class[])
, but for multiple scripts.- Specified by:
setThrownExceptions
in interfaceIScriptEvaluator
-
cook
Likecook(Scanner)
, but cooks a set of scripts into one class. Notice that if any of the scripts causes trouble, the entire compilation will fail. If you need to report which of the scripts causes the exception, you may want to use theoptionalFileName
argument ofScanner(String, Reader)
to distinguish between the individual token sources.On a 2 GHz Intel Pentium Core Duo under Windows XP with an IBM 1.4.2 JDK, compiling 10000 expressions "a + b" (integer) takes about 4 seconds and 56 MB of main memory. The generated class file is 639203 bytes large.
The number and the complexity of the scripts is restricted by the Limitations of the Java Virtual Machine, where the most limiting factor is the 64K entries limit of the constant pool. Since every method with a distinct name requires one entry there, you can define at best 32K (very simple) scripts. If and only if the number of scanners is one, then that single script may contain leading IMPORT directives.
- Throws:
IllegalStateException
- Any of the preceedingset...()
had an array size different from that ofscanners
CompileException
IOException
-
cook
- Throws:
CompileException
IOException
-
cook
Description copied from interface:IScriptEvaluator
Same asICookable.cook(Reader)
, but for multiple scripts.- Specified by:
cook
in interfaceIScriptEvaluator
- Throws:
CompileException
IOException
-
cook
public final void cook(String[] optionalFileNames, Reader[] readers) throws CompileException, IOException On a 2 GHz Intel Pentium Core Duo under Windows XP with an IBM 1.4.2 JDK, compiling 10000 expressions "a + b" (integer) takes about 4 seconds and 56 MB of main memory. The generated class file is 639203 bytes large.The number and the complexity of the scripts is restricted by the Limitations of the Java Virtual Machine, where the most limiting factor is the 64K entries limit of the constant pool. Since every method with a distinct name requires one entry there, you can define at best 32K (very simple) scripts.
- Specified by:
cook
in interfaceIScriptEvaluator
- Throws:
CompileException
IOException
-
cook
Description copied from interface:IScriptEvaluator
Same asICookable.cook(String)
, but for multiple scripts.- Specified by:
cook
in interfaceIScriptEvaluator
- Throws:
CompileException
-
cook
Description copied from interface:IScriptEvaluator
Same asICookable.cook(String, String)
, but for multiple scripts.- Specified by:
cook
in interfaceIScriptEvaluator
- Throws:
CompileException
-
getDefaultReturnType
- Returns:
void.class
- See Also:
-
makeStatements
Fill the givenblock
by parsing statements until EOF and adding them to the block.- Throws:
CompileException
IOException
-
compileToMethods
protected void compileToMethods(Java.CompilationUnit compilationUnit, String[] methodNames, Class[][] parameterTypes) throws CompileException - Throws:
CompileException
-
makeMethodDeclaration
protected Java.MethodDeclarator makeMethodDeclaration(Location location, Java.Annotation[] annotations, boolean staticMethod, Class returnType, String methodName, Class[] parameterTypes, String[] parameterNames, Class[] thrownExceptions, List statements) To the givenJava.ClassDeclaration
, add- A public method declaration with the given return type, name, parameter names and values and thrown exceptions
- A block
- Parameters:
annotations
- TODOreturnType
- Return type of the declared method
-
createFastScriptEvaluator
@Deprecated public static Object createFastScriptEvaluator(String script, Class interfaceToImplement, String[] parameterNames) throws CompileException Deprecated.- Throws:
CompileException
-
createFastScriptEvaluator
@Deprecated public static Object createFastScriptEvaluator(Scanner scanner, Class interfaceToImplement, String[] parameterNames, ClassLoader optionalParentClassLoader) throws CompileException, IOException Deprecated.- Throws:
CompileException
IOException
-
createFastScriptEvaluator
@Deprecated public static Object createFastScriptEvaluator(Scanner scanner, String className, Class optionalExtendedType, Class interfaceToImplement, String[] parameterNames, ClassLoader optionalParentClassLoader) throws CompileException, IOException Deprecated.- Throws:
CompileException
IOException
-
createFastScriptEvaluator
@Deprecated public static Object createFastScriptEvaluator(Scanner scanner, String[] optionalDefaultImports, String className, Class optionalExtendedClass, Class interfaceToImplement, String[] parameterNames, ClassLoader optionalParentClassLoader) throws CompileException, IOException Deprecated.UsecreateFastEvaluator(Scanner,Class,String[])
instead:ScriptEvaluator
se = newScriptEvaluator
(); se.setDefaultImports
.(optionalDefaultImports); se.setClassName
.(className); se.setExtendedClass
.(optionalExtendedClass); se.setParentClassLoader
(optionalParentClassLoader); return se.createFastEvaluator
(scanner, interfaceToImplement, parameterNames);- Throws:
CompileException
IOException
-
createInstance
Don't use.- Specified by:
createInstance
in interfaceIClassBodyEvaluator
- Overrides:
createInstance
in classClassBodyEvaluator
- Parameters:
reader
- Source of class body tokens- Returns:
- An object that extends the
optionalExtendedType
and implements the givenimplementedTypes
-
createFastEvaluator
public Object createFastEvaluator(Reader reader, Class 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 =
All other configuration (implemented type, static method, return type, method name, parameter names and types, thrown exceptions) are predetermined by theCompilerFactoryFactory
.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));interfaceToImplement
. Notice: TheinterfaceToImplement
must either be declaredpublic
, or with package scope in the same package as the generated class (seeIClassBodyEvaluator.setClassName(String)
).- Specified by:
createFastEvaluator
in interfaceIScriptEvaluator
- Parameters:
reader
- Produces the stream of script tokensinterfaceToImplement
- Must declare exactly one methodparameterNames
- The names of the parameters of that method- Returns:
- An object that implements the given interface
- Throws:
CompileException
IOException
-
createFastEvaluator
public Object createFastEvaluator(String script, Class interfaceToImplement, String[] parameterNames) throws CompileException - Specified by:
createFastEvaluator
in interfaceIScriptEvaluator
- Parameters:
script
- Contains the sequence of script tokens- Throws:
CompileException
- See Also:
-
createFastEvaluator
public Object createFastEvaluator(Scanner scanner, Class interfaceToImplement, String[] parameterNames) throws CompileException, IOException Notice: This method is not declared inIScriptEvaluator
, and is hence only available in this implementation oforg.codehaus.commons.compiler
. To be independent from this particular implementation, try to switch tocreateFastEvaluator(Reader, Class, String[])
.- Parameters:
scanner
- Source of tokens to read- Throws:
CompileException
IOException
- See Also:
-
guessParameterNames
Guess the names of the parameters used in the given expression. The strategy is to look at all "ambiguous names" in the expression (e.g. in "a.b.c.d()", the ambiguous name is "a.b.c"), and then at the components of the ambiguous name.- If any component starts with an upper-case letter, then ambiguous name is assumed to be a type name.
- Otherwise, if the first component of the ambiguous name matches the name of a previously defined local variable, then the first component of the ambiguous name is assumed to be a local variable name. (Notice that this strategy does not consider that the scope of a local variable declaration may end before the end of the script.)
- Otherwise, the first component of the ambiguous name is assumed to be a parameter name.
- Throws:
CompileException
IOException
- See Also:
-
evaluate
Description copied from interface:IScriptEvaluator
Same asIScriptEvaluator.evaluate(Object[])
, but for multiple scripts.- Specified by:
evaluate
in interfaceIScriptEvaluator
- Throws:
InvocationTargetException
-
getMethod
Description copied from interface:IScriptEvaluator
Same asIScriptEvaluator.getMethod()
, but for multiple scripts.- Specified by:
getMethod
in interfaceIScriptEvaluator
-
createFastScriptEvaluator(Scanner, String[], String, Class, Class, String[], ClassLoader)
instead