public class EnvironmentModule extends AbstractEnvironment
Modifier and Type | Field and Description |
---|---|
static String |
MODULE_NAME |
static String |
MODULE_PREFIX |
Constructor and Description |
---|
EnvironmentModule() |
Modifier and Type | Method and Description |
---|---|
Object |
execute(Object data)
Execute script code.
|
void |
exit(Object value)
Terminates script execution immediately.
|
IScriptEngine |
getScriptEngine()
Get the current script engine instance.
|
static String |
getWrappedVariableName(Object toBeWrapped) |
void |
help(String topic)
Open help page on addressed topic.
|
Object |
include(String filename)
Include and execute a script file.
|
boolean |
loadJar(Object location)
Add a jar file to the classpath.
|
Object |
wrap(Object toBeWrapped,
boolean useCustomNamespace)
Wrap a java instance.
|
addModuleListener, getEnvironment, getModule, getModule, getModules, initialize, listModules, loadModule, print, printError, readInput, removeModuleListener
public static final String MODULE_NAME
public static final String MODULE_PREFIX
public Object wrap(Object toBeWrapped, @ScriptParameter(defaultValue="false") boolean useCustomNamespace)
IEnvironment
WrapToScript
only these will be wrapped. If no annotation can be found, all public methods/constants will
be wrapped. As some target languages might not support method overloading this might result in some methods not wrapped correctly.toBeWrapped
- instance to be wrappeduseCustomNamespace
- set to true
if functions and constants should not be stored to the global namespace but to the return value onlypublic final Object execute(Object data)
data
- code to be interpretedpublic final void exit(@ScriptParameter(defaultValue="org.eclipse.ease.modules.ScriptParameter.null") Object value)
value
- return codepublic final Object include(String filename)
filename
- name of file to be includedThrowable
public IScriptEngine getScriptEngine()
getScriptEngine
in interface IEnvironment
getScriptEngine
in class AbstractScriptModule
IScriptEngine
instancepublic boolean loadJar(Object location) throws MalformedURLException
location
- URL
, Path
, File
or IFile
true
when input could be converted to a URLMalformedURLException
- invalid URL detectedpublic void help(@ScriptParameter(defaultValue="org.eclipse.ease.modules.ScriptParameter.null") String topic)
topic
- help topic to open (typically a function name)