|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.norther.tammi.core.scripter.lang.AbstractEngine org.norther.tammi.core.scripter.lang.AbstractInterpreter
public abstract class AbstractInterpreter
An abstract interpreter adapter for BSF engines.
Field Summary |
---|
Fields inherited from interface org.norther.tammi.core.scripter.lang.Interpreter |
---|
JAVA_LANGUAGE |
Fields inherited from interface org.norther.tammi.core.scripter.lang.ScriptEngine |
---|
APPLY, ARGUMENTS, EVALUATE, EXECUTE, MAIN |
Constructor Summary | |
---|---|
AbstractInterpreter()
Constructs a new interpreter. |
Method Summary | |
---|---|
void |
addClassPath(String path)
Adds a class search path. |
void |
addClassURL(URL url)
Adds a class search URL. |
Class<?> |
defineClass(String name,
byte[] code)
Converts an array of bytes into a class. |
void |
defineVariable(String name,
Object value)
Defines a variable in the interpreter environment. |
void |
defineVariable(String name,
Object value,
Class<?> c)
Defines a variable of the specified class. |
ClassLoader |
getClassLoader()
Gets the class loader. |
Set<String> |
getClassNames()
Gets the defined class names. |
protected abstract Interpreter |
getInterpreter()
Gets the adapted interpreter. |
Object |
getVariable(String name)
Gets the value of a variable. |
Class<?> |
getVariableClass(String name)
Gets the class of a variable. |
Set<String> |
getVariableNames()
Gets the defined variable names. |
Object |
interpret(File file)
Interprets a file. |
Object |
interpret(InputStream in,
String fname)
Interprets an input stream. |
Object |
interpret(Reader r,
String fname)
Interprets a reader. |
Object |
interpret(String s,
String fname)
Interprets a string. |
Object |
interpret(URL url)
Interprets a URL. |
boolean |
isDefined(String name)
Checks whether a variable is defined. |
Class<?> |
loadClass(String name)
Loads an interpreted class. |
void |
reset()
Resets this interpreter. |
void |
setVariable(String name,
Object value)
Sets the value of a variable. |
Methods inherited from class org.norther.tammi.core.scripter.lang.AbstractEngine |
---|
compileApply, compileExpr, compileScript, exec, getClassPath, getDeclaredBeans, getInitializer, getLanguage, getTempDirectory, iexec, initialize, isInitialized, propertyChange, reinitialize, setClassLoader, setClassPath, setInitializer, setTempDirectory, terminate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.bsf.BSFEngine |
---|
apply, call, declareBean, eval, undeclareBean |
Constructor Detail |
---|
public AbstractInterpreter()
Method Detail |
---|
public Object interpret(String s, String fname)
Interpreter
interpret
in interface Interpreter
s
- the string from which the statements are read.fname
- the name of the parsed string.
public Object interpret(InputStream in, String fname)
Interpreter
interpret
in interface Interpreter
in
- the input stream from which the statements are read.fname
- the name of the parsed stream.
public Object interpret(Reader r, String fname)
Interpreter
interpret
in interface Interpreter
r
- the reader.fname
- the name of the parsed stream.
public Object interpret(File file) throws IOException
Interpreter
interpret
in interface Interpreter
file
- the file to interpret.
IOException
- on I/O errors.public Object interpret(URL url) throws IOException
Interpreter
interpret
in interface Interpreter
url
- the url to interpret.
IOException
- on I/O errors.public void defineVariable(String name, Object value)
Interpreter
defineVariable
in interface Interpreter
name
- the variable's name.value
- the initial value of the variable.public void defineVariable(String name, Object value, Class<?> c)
Interpreter
defineVariable
in interface Interpreter
name
- the name.value
- the value.c
- the class.public boolean isDefined(String name)
Interpreter
isDefined
in interface Interpreter
name
- the name.
public Object getVariable(String name)
Interpreter
getVariable
in interface Interpreter
name
- the variable name.
public void setVariable(String name, Object value)
Interpreter
setVariable
in interface Interpreter
name
- the variable name.value
- the value of the variable.public Class<?> getVariableClass(String name)
Interpreter
getVariableClass
in interface Interpreter
name
- the variable name.
public Set<String> getVariableNames()
Interpreter
getVariableNames
in interface Interpreter
public void addClassPath(String path)
Interpreter
addClassPath
in interface Interpreter
path
- the path to add.public void addClassURL(URL url)
Interpreter
addClassURL
in interface Interpreter
url
- the url to add.public Class<?> loadClass(String name) throws ClassNotFoundException
Interpreter
loadClass
in interface Interpreter
name
- the fully qualified name of the class to load.
ClassNotFoundException
- if the class cannot be find.public Class<?> defineClass(String name, byte[] code)
Interpreter
defineClass
in interface Interpreter
name
- the fully qualified name of the class to load.code
- the byte code of the class.
public Set<String> getClassNames()
Interpreter
getClassNames
in interface Interpreter
public ClassLoader getClassLoader()
AbstractEngine
getClassLoader
in interface Interpreter
getClassLoader
in class AbstractEngine
public void reset()
Interpreter
reset
in interface Interpreter
protected abstract Interpreter getInterpreter()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |