public class JaclInterpreter extends java.lang.Object implements Interpreter
Interpreter
interface to use
JACL Tcl parser.Modifier and Type | Field and Description |
---|---|
private Interp |
interpreter |
Constructor and Description |
---|
JaclInterpreter() |
Modifier and Type | Method and Description |
---|---|
void |
bindObject(java.lang.String name,
java.lang.Object object)
This method should register a particular Java
Object in
the environment of the interpreter. |
void |
dispose()
This method can dispose resources used by the interpreter when it is
no longer used.
|
java.lang.Object |
evaluate(java.io.Reader scriptreader)
This method should evaluate a piece of script.
|
java.lang.Object |
evaluate(java.io.Reader scriptreader,
java.lang.String description)
This method should evaluate a piece of script associated to a given
description.
|
java.lang.Object |
evaluate(java.lang.String script)
This method should evaluate a piece of script using a
String
instead of a Reader . |
java.lang.String |
formatMessage(java.lang.String key,
java.lang.Object[] args)
Creates and returns a localized message, given the key of the message
in the resource bundle and the message parameters.
|
java.util.Locale |
getLocale()
Returns the current locale or null if the locale currently used is
the default one.
|
java.lang.String[] |
getMimeTypes()
Returns the content types of the scripting languages this interpreter
handles.
|
void |
setLocale(java.util.Locale locale)
Provides a way to the user to specify a locale which override the
default one.
|
void |
setOut(java.io.Writer out)
This method should change the output
Writer that will be
used when output function of the scripting langage is used. |
public java.lang.String[] getMimeTypes()
getMimeTypes
in interface Interpreter
public java.lang.Object evaluate(java.io.Reader scriptreader) throws java.io.IOException
Interpreter
evaluate
in interface Interpreter
scriptreader
- a java.io.Reader
on the piece of scriptjava.io.IOException
public java.lang.Object evaluate(java.io.Reader scriptreader, java.lang.String description) throws java.io.IOException
Interpreter
evaluate
in interface Interpreter
scriptreader
- a java.io.Reader
on the piece of scriptdescription
- description which can be later used (e.g., for error
messages).java.io.IOException
public java.lang.Object evaluate(java.lang.String script)
Interpreter
String
instead of a Reader
. This usually allows do easily do some
caching.evaluate
in interface Interpreter
script
- the piece of scriptpublic void dispose()
Interpreter
dispose
in interface Interpreter
public void bindObject(java.lang.String name, java.lang.Object object)
Interpreter
Object
in
the environment of the interpreter.bindObject
in interface Interpreter
name
- the name of the script object to createobject
- the Java objectpublic void setOut(java.io.Writer out)
Interpreter
Writer
that will be
used when output function of the scripting langage is used.setOut
in interface Interpreter
out
- the new out Writer
.public java.util.Locale getLocale()
Localizable
getLocale
in interface Localizable
public void setLocale(java.util.Locale locale)
Localizable
setLocale
in interface Localizable
locale
- The locale to set.public java.lang.String formatMessage(java.lang.String key, java.lang.Object[] args)
Localizable
formatMessage
in interface Localizable
key
- The key used to retreive the message from the resource
bundle.args
- The objects that compose the message.