org.eclipse.actf.validation.valdoc.scripting
Class JavaScriptCodeInterpreter
java.lang.Object
org.eclipse.actf.validation.valdoc.codeproc.AbstractCodeProcessor
org.eclipse.actf.validation.valdoc.scripting.AbstractCodeInterpreter
org.eclipse.actf.validation.valdoc.scripting.JavaScriptCodeInterpreter
- All Implemented Interfaces:
- ICodeProcessor
public class JavaScriptCodeInterpreter
- extends AbstractCodeInterpreter
A code interpreter for scripts written in JavaScript/Rhino.
- Author:
- Mike Squillace
Methods inherited from class org.eclipse.actf.validation.valdoc.scripting.AbstractCodeInterpreter |
addScript, addScript, evaluateArguments, evaluateArguments, getEnvironment, getExpressionDelimiter, getInitCode, getLanguageSupportsTuples, getNullValue, getScript, isCompilerProcessor, postInit, preInit, processCode, setClasspath, setEnvironment, setLanguageSupportsTuples, setLocal |
Methods inherited from class org.eclipse.actf.validation.valdoc.codeproc.AbstractCodeProcessor |
addScript, addScripts, getClasspath, getFileContents, getLanguage, getModel, isIdVisible, makeExpressionList, prepareCode, setIdVisibility, setLanguage, setModel |
JavaScriptCodeInterpreter
public JavaScriptCodeInterpreter(String lang,
IModel model)
- create a new interpreter for JavaScript
- Parameters:
lang
- model
-
initClasspath
protected void initClasspath()
- Description copied from class:
AbstractCodeInterpreter
- initializes the underlying scripting engine with the classpath supplied
via
setClasspath
. This will be the classpath referenced
from within actual script code.
- Overrides:
initClasspath
in class AbstractCodeInterpreter
- See Also:
AbstractCodeInterpreter.setClasspath(String)
formatPackageImport
protected String formatPackageImport(String packageName)
- Specified by:
formatPackageImport
in class AbstractCodeInterpreter
toJavaObject
protected Object toJavaObject(Object o,
Class c)
- overwritten by those interpreters that wrap the results of evaluations in
API-specific instances
- Specified by:
toJavaObject
in class AbstractCodeInterpreter
- Parameters:
o
- --
wrapped objectc
- --
desired type
- Returns:
- "unwrapped" o as type c
toJavaObjects
protected Object[] toJavaObjects(Object o,
Class[] paramTypes)
- convert the given object to an array of objects of the specified types.
This version is typically used by those interpreters in which
languageSupportsTuples()
returns true
- Specified by:
toJavaObjects
in class AbstractCodeInterpreter
- Parameters:
o
- --
API-dependent tuple objectparamTypes
- --
desired types of returned objects
- Returns:
- array of objects of the specified types or
null
if
conversion could not be performed - See Also:
AbstractCodeInterpreter.getLanguageSupportsTuples()
finalize
protected void finalize()
throws Throwable
- Overrides:
finalize
in class Object
- Throws:
Throwable