|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Interpreter
An interface to language interpreters.
Field Summary | |
---|---|
static String |
JAVA_LANGUAGE
The java language. |
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. |
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. |
Field Detail |
---|
static final String JAVA_LANGUAGE
Method Detail |
---|
Object interpret(String s, String fname)
s
- the string from which the statements are read.fname
- the name of the parsed string.
Error
- if interpretation fails.Object interpret(InputStream in, String fname)
in
- the input stream from which the statements are read.fname
- the name of the parsed stream.
Error
- if interpretation fails.Object interpret(Reader r, String fname)
r
- the reader.fname
- the name of the parsed stream.
Error
- if interpretation fails.Object interpret(File file) throws IOException
file
- the file to interpret.
Error
- if interpretation fails.
IOException
- on I/O errors.Object interpret(URL url) throws IOException
url
- the url to interpret.
Error
- if interpretation fails.
IOException
- on I/O errors.void defineVariable(String name, Object value)
name
- the variable's name.value
- the initial value of the variable.
IllegalStateException
- if name is already defined.void defineVariable(String name, Object value, Class<?> c)
name
- the name.value
- the value.c
- the class.boolean isDefined(String name)
name
- the name.
Object getVariable(String name)
name
- the variable name.
IllegalStateException
- if the variable does not exist.void setVariable(String name, Object value)
name
- the variable name.value
- the value of the variable.
IllegalStateException
- if the assignment is invalid.Class<?> getVariableClass(String name)
name
- the variable name.
IllegalStateException
- if the variable does not exist.Set<String> getVariableNames()
void addClassPath(String path)
path
- the path to add.void addClassURL(URL url)
url
- the url to add.Class<?> loadClass(String name) throws ClassNotFoundException
name
- the fully qualified name of the class to load.
ClassNotFoundException
- if the class cannot be find.Class<?> defineClass(String name, byte[] code)
name
- the fully qualified name of the class to load.code
- the byte code of the class.
ClassFormatError
- if the class could not be defined.Set<String> getClassNames()
ClassLoader getClassLoader()
void reset()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |