public class FakeGenericInterpreter extends Object implements GenericInterpreter
| Constructor and Description |
|---|
FakeGenericInterpreter() |
| Modifier and Type | Method and Description |
|---|---|
Object |
eval(Reader reader)
Same as
eval(String) except that the source of the script
is provided as a Reader |
Object |
eval(String script)
Executes the specified script.
|
Object |
get(String key)
Retrieves a value set in the state of this engine.
|
Writer |
getErrorWriter()
Returns the
Writer used to display error output. |
Reader |
getReader()
Returns a
Reader to be used by the script to read input. |
Writer |
getWriter()
Returns the
Writer for scripts to use when displaying
output. |
void |
put(String key,
Object value)
Sets a key/value pair in the state of the ScriptEngine that may either
create a Java Language Binding to be used in the execution of scripts or
be used in some other way, depending on whether the key is reserved.
|
void |
setErrorWriter(Writer writer)
Sets the
Writer used to display error output. |
void |
setReader(Reader reader)
Sets the
Reader for scripts to read input . |
void |
setWriter(Writer writer)
Sets the
Writer for scripts to use when displaying output. |
public Object eval(String script) throws ScriptException
GenericInterpreterScriptContext
for the ScriptEngine is used.eval in interface GenericInterpreterscript - The script language source to be executed.ScriptException - if error occurrs in script.public Object eval(Reader reader) throws ScriptException
GenericInterpretereval(String) except that the source of the script
is provided as a Readereval in interface GenericInterpreterreader - The source of the script.ScriptException - if an error occurrs in script.public Object get(String key)
GenericInterpretersetValue or some other value in the
state of the ScriptEngine, depending on the
implementation. Must have the same effect as
getBindings(ScriptContext.ENGINE_SCOPE).getget in interface GenericInterpreterkey - The key whose value is to be returnedpublic Writer getErrorWriter()
GenericInterpreterWriter used to display error output.getErrorWriter in interface GenericInterpreterWriterpublic Reader getReader()
GenericInterpreterReader to be used by the script to read input.getReader in interface GenericInterpreterReader.public Writer getWriter()
GenericInterpreterWriter for scripts to use when displaying
output.getWriter in interface GenericInterpreterWriter.public void put(String key, Object value)
GenericInterpretergetBindings(ScriptContext.ENGINE_SCOPE).put.put in interface GenericInterpreterkey - The name of named value to addvalue - The value of named value to add.public void setErrorWriter(Writer writer)
GenericInterpreterWriter used to display error output.setErrorWriter in interface GenericInterpreterwriter - The Writer.public void setReader(Reader reader)
GenericInterpreterReader for scripts to read input .setReader in interface GenericInterpreterreader - The new Reader.public void setWriter(Writer writer)
GenericInterpreterWriter for scripts to use when displaying output.setWriter in interface GenericInterpreterwriter - The new Writer.Copyright © 2007-2013 Artenum. All Rights Reserved.