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
GenericInterpreter
ScriptContext
for the ScriptEngine
is used.eval
in interface GenericInterpreter
script
- The script language source to be executed.ScriptException
- if error occurrs in script.public Object eval(Reader reader) throws ScriptException
GenericInterpreter
eval(String)
except that the source of the script
is provided as a Reader
eval
in interface GenericInterpreter
reader
- The source of the script.ScriptException
- if an error occurrs in script.public Object get(String key)
GenericInterpreter
setValue
or some other value in the
state of the ScriptEngine
, depending on the
implementation. Must have the same effect as
getBindings(ScriptContext.ENGINE_SCOPE).get
get
in interface GenericInterpreter
key
- The key whose value is to be returnedpublic Writer getErrorWriter()
GenericInterpreter
Writer
used to display error output.getErrorWriter
in interface GenericInterpreter
Writer
public Reader getReader()
GenericInterpreter
Reader
to be used by the script to read input.getReader
in interface GenericInterpreter
Reader
.public Writer getWriter()
GenericInterpreter
Writer
for scripts to use when displaying
output.getWriter
in interface GenericInterpreter
Writer
.public void put(String key, Object value)
GenericInterpreter
getBindings(ScriptContext.ENGINE_SCOPE).put
.put
in interface GenericInterpreter
key
- The name of named value to addvalue
- The value of named value to add.public void setErrorWriter(Writer writer)
GenericInterpreter
Writer
used to display error output.setErrorWriter
in interface GenericInterpreter
writer
- The Writer
.public void setReader(Reader reader)
GenericInterpreter
Reader
for scripts to read input .setReader
in interface GenericInterpreter
reader
- The new Reader
.public void setWriter(Writer writer)
GenericInterpreter
Writer
for scripts to use when displaying output.setWriter
in interface GenericInterpreter
writer
- The new Writer
.Copyright © 2007–2017 Artenum. All rights reserved.