public abstract class BeanShellFacade<T>
extends java.lang.Object
BeanShell| Modifier and Type | Field and Description |
|---|---|
protected BshClassManager |
classManager |
protected NameSpace |
global |
| Modifier | Constructor and Description |
|---|---|
protected |
BeanShellFacade() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
_eval(T view,
NameSpace namespace,
java.lang.String command)
Evaluates the specified BeanShell expression.
|
BshMethod |
cacheBlock(java.lang.String id,
java.lang.String code,
boolean namespace)
Caches a block of code, returning a handle that can be passed to
runCachedBlock().
|
protected static Interpreter |
createInterpreter(NameSpace nameSpace) |
java.lang.Object |
eval(T param,
NameSpace namespace,
java.lang.String command)
Evaluates the specified BeanShell expression.
|
java.lang.Object |
eval(T param,
java.lang.String command)
Evaluates the specified BeanShell expression with the global namespace
|
void |
evalSelection(T param,
TextArea textArea)
Evaluates the text selected in the specified text area.
|
NameSpace |
getNameSpace() |
protected abstract void |
handleException(T param,
java.lang.String path,
java.lang.Throwable t) |
protected void |
init()
Initialize things.
|
protected abstract void |
resetDefaultVariables(NameSpace namespace) |
java.lang.Object |
runCachedBlock(BshMethod method,
T param,
NameSpace namespace)
Runs a cached block of code in the specified namespace.
|
protected abstract void |
setupDefaultVariables(NameSpace namespace,
T param) |
protected void |
setVariable(NameSpace nameSpace,
java.lang.String name,
java.lang.Object object)
Set a beanshell variable in the namespace without overriding it
|
protected static void |
unwrapException(java.lang.Exception e)
This extracts an exception from a 'wrapping' exception, as BeanShell
sometimes throws.
|
protected NameSpace global
protected BshClassManager classManager
protected void init()
public void evalSelection(T param, TextArea textArea)
param - some sort of parametertextArea - the textAreapublic java.lang.Object eval(T param, java.lang.String command)
param - The parametercommand - The expressionpublic java.lang.Object eval(T param, NameSpace namespace, java.lang.String command)
param - The parameternamespace - The namespacecommand - The expressionpublic java.lang.Object _eval(T view, NameSpace namespace, java.lang.String command) throws java.lang.Exception
eval(), this method passes any exceptions to the caller.view - The view. Within the script, references to
buffer, textArea and editPane
are determined with reference to this parameter.namespace - The namespacecommand - The expressionjava.lang.Exception - instances are thrown when various BeanShell
errors occurpublic BshMethod cacheBlock(java.lang.String id, java.lang.String code, boolean namespace) throws java.lang.Exception
id - An identifier.code - The codenamespace - If true, the namespace will be setjava.lang.Exception - instances are thrown when various BeanShell errors
occurpublic java.lang.Object runCachedBlock(BshMethod method, T param, NameSpace namespace) throws java.lang.Exception
method - The method instance returned by cacheBlock()param - a parameternamespace - The namespace to run the code injava.lang.Exception - instances are thrown when various BeanShell
errors occurpublic NameSpace getNameSpace()
protected void setVariable(NameSpace nameSpace, java.lang.String name, java.lang.Object object) throws UtilEvalError
nameSpace - the namespacename - the name of the variableobject - the value of the variableUtilEvalError - when there is an errorprotected abstract void setupDefaultVariables(NameSpace namespace, T param) throws UtilEvalError
UtilEvalErrorprotected abstract void resetDefaultVariables(NameSpace namespace) throws UtilEvalError
UtilEvalErrorprotected abstract void handleException(T param, java.lang.String path, java.lang.Throwable t)
protected static Interpreter createInterpreter(NameSpace nameSpace)
protected static void unwrapException(java.lang.Exception e)
throws java.lang.Exception
e - the exceptionjava.lang.Exception - on error