public interface ScriptContext
| Modifier and Type | Method and Description |
|---|---|
void |
addChildScriptContext(ScriptContext context)
Adds child contexts to this context.
|
boolean |
equals(Object obj)
Tests if this ScriptContext is equal to another ScriptContext.
|
void |
finalize()
This method overrides finalization to ensure that active script context
will not be collected by GC.
|
Collection<ScriptContext> |
getChildScriptContexts()
Returns list of child contexts or null if no contextes present
|
ClassListener |
getClassListener()
Returns class listener associated with this ScriptContext.
|
CompilationResult |
getCompilationResult()
Returns compilation result of this script context
|
String |
getCompilerClassName()
Returns compiler class name that will be used for this script context.
|
Iterable<File> |
getLibraries()
Returns list of files that are used as libraries for this script context
|
ScriptContext |
getParentScriptContext()
Returns parent script context of this context.
|
File |
getRoot()
Returns the root directory for script engine.
|
int |
hashCode()
Returns hashCoded of this ScriptContext.
|
void |
init()
Initializes script context.
|
boolean |
isInitialized()
Returns true if this script context is loaded
|
void |
reload()
Invokes
shutdown(), after that invokes init(). |
void |
setClassListener(ClassListener cl)
Sets the class listener for this script context.
|
void |
setCompilerClassName(String className)
Sets compiler class name for this script context.
|
void |
setLibraries(Iterable<File> files)
Sets files that represents jar files, they will be used as libraries
|
void |
shutdown()
Notifies all script classes that they must save their data and release
resources to prevent memory leaks.
|
void init()
OnClassLoad are invokedvoid shutdown()
OnClassUnload annotationvoid reload()
shutdown(), after that invokes init(). Root
folder remains the same, but new compiler and classloader are used.File getRoot()
CompilationResult getCompilationResult()
boolean isInitialized()
void setLibraries(Iterable<File> files)
files - that points to jar file, will be used as librariesIterable<File> getLibraries()
ScriptContext getParentScriptContext()
Collection<ScriptContext> getChildScriptContexts()
void addChildScriptContext(ScriptContext context)
init() would be
called. Duplicated child contexts are not allowed, in such case child
will be ignoredcontext - child contextvoid setClassListener(ClassListener cl)
cl - class listenerClassListener getClassListener()
AggregatedClassListener acl = new AggregatedClassListener(); acl.addClassListener(new OnClassLoadUnloadListener()); acl.addClassListener(new ScheduledTaskClassListener());
AggregatedClassListener,
ScheduledTaskClassListenervoid setCompilerClassName(String className)
className - compiler class nameString getCompilerClassName()
boolean equals(Object obj)
int hashCode()
void finalize()
throws Throwable
shutdown() is called to ensure that resources were released.Throwable - if something goes wrong during finalizationCopyright © 2014–2015. All rights reserved.