public abstract class AbstractEnvironment extends AbstractScriptModule implements IEnvironment
| Constructor and Description |
|---|
AbstractEnvironment() |
| Modifier and Type | Method and Description |
|---|---|
void |
addModuleListener(IModuleListener listener) |
static IEnvironment |
getEnvironment(IScriptEngine engine) |
Object |
getModule(String name)
Resolves a loaded module and returns the Java instance.
|
<T,U extends Class<T>> |
getModule(U clazz)
Resolves a loaded module by its class.
|
List<Object> |
getModules()
Retrieve a list of loaded modules.
|
void |
initialize(IScriptEngine engine,
IEnvironment environment)
Provides script engine and environment instances.
|
String |
listModules()
List all available (visible) modules.
|
Object |
loadModule(String identifier)
Load a module.
|
void |
print(Object text)
Print to standard output.
|
void |
removeModuleListener(IModuleListener listener) |
getScriptEngineequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetScriptEngine, wrappublic final Object loadModule(String identifier)
loadModule in interface IEnvironmentname - name of module to loadpublic void initialize(IScriptEngine engine, IEnvironment environment)
IScriptModuleinitialize in interface IScriptModuleinitialize in class AbstractScriptModuleengine - script engine this module is loaded inenvironment - environment module that tracks this modulepublic final String listModules()
public final Object getModule(String name)
getModule in interface IEnvironmentname - name of the module to resolvenullpublic <T,U extends Class<T>> T getModule(U clazz)
getModule in interface IEnvironmentclazz - module class to look resolvenullpublic List<Object> getModules()
IEnvironmentgetModules in interface IEnvironmentpublic final void print(@ScriptParameter(defaultValue="") Object text)
IEnvironmentprint in interface IEnvironmenttext - text to write to standard outputpublic void addModuleListener(IModuleListener listener)
addModuleListener in interface IEnvironmentpublic void removeModuleListener(IModuleListener listener)
removeModuleListener in interface IEnvironmentpublic static IEnvironment getEnvironment(IScriptEngine engine)