|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.batik.script.rhino.RhinoInterpreter
A simple implementation of Interpreter interface to use
Rhino ECMAScript interpreter.
| Nested Class Summary | |
static interface |
RhinoInterpreter.ArgumentsBuilder
To build an argument list. |
class |
RhinoInterpreter.ExtendedContext
|
static class |
RhinoInterpreter.RhinoGetDelegate
Class to act as 'get' delegate for Rhino. |
| Field Summary | |
static String |
BIND_NAME_WINDOW
Name of the "window" object when referenced by scripts |
protected RhinoClassLoader |
rhinoClassLoader
The Rhino 'security domain'. |
static String |
SOURCE_NAME_SVG
Constant used to describe an SVG source |
protected Window |
window
The window object |
| Constructor Summary | |
RhinoInterpreter(URL documentURL)
Build a Interpreter for ECMAScript using Rhino. |
|
| Method Summary | |
void |
bindObject(String name,
Object object)
This method registers a particular Java Object in
the environment of the interpreter. |
void |
dispose()
For RhinoInterpreter this method flushes the
Rhino caches to avoid memory leaks. |
Context |
enterContext()
Implementation helper. |
Object |
evaluate(Reader scriptreader)
This method evaluates a piece of ECMAScript. |
Object |
evaluate(Reader scriptreader,
String description)
This method evaluates a piece of ECMAScript. |
Object |
evaluate(String scriptstr)
This method evaluates a piece of ECMA script. |
String |
formatMessage(String key,
Object[] args)
Creates and returns a localized message, given the key of the message, 0, data.length in the resource bundle and the message parameters. |
AccessControlContext |
getAccessControlContext()
Returns the AccessControlContext associated with this Interpreter. |
protected ScriptableObject |
getGlobalObject()
This method returns the ECMAScript global object used by this interpreter. |
Locale |
getLocale()
Returns the current locale or null if the locale currently used is the default one. |
Window |
getWindow()
|
void |
setLocale(Locale locale)
Provides a way to the user to specify a locale which override the default one. |
void |
setOut(Writer out)
By default Rhino has no output method in its language. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected Window window
public static final String SOURCE_NAME_SVG
public static final String BIND_NAME_WINDOW
protected RhinoClassLoader rhinoClassLoader
| Constructor Detail |
public RhinoInterpreter(URL documentURL)
Interpreter for ECMAScript using Rhino.
documentURL - the URL for the document which referencesInterpreter,
InterpreterPool| Method Detail |
public Window getWindow()
public AccessControlContext getAccessControlContext()
RhinoClassLoaderpublic Context enterContext()
protected ScriptableObject getGlobalObject()
public Object evaluate(Reader scriptreader)
throws InterpreterException,
IOException
evaluate in interface Interpreterscriptreader - a java.io.Reader on the piece of script
InterpreterException
IOException
public Object evaluate(Reader scriptreader,
String description)
throws InterpreterException,
IOException
evaluate in interface Interpreterscriptreader - a java.io.Reader on the piece of scriptdescription - description which can be later used (e.g., for error
messages).
InterpreterException
IOException
public Object evaluate(String scriptstr)
throws InterpreterException
evaluate in interface Interpreterscriptstr - the piece of script
InterpreterExceptionpublic void dispose()
RhinoInterpreter this method flushes the
Rhino caches to avoid memory leaks.
dispose in interface Interpreter
public void bindObject(String name,
Object object)
Object in
the environment of the interpreter.
bindObject in interface Interpretername - the name of the script object to createobject - the Java objectpublic void setOut(Writer out)
setOut in interface Interpreterout - the new out Writer.public Locale getLocale()
getLocale in interface Localizablepublic void setLocale(Locale locale)
setLocale in interface Localizablelocale - The locale to set.
public String formatMessage(String key,
Object[] args)
formatMessage in interface Localizablekey - The key used to retreive the message from the resource
bundle.args - The objects that compose the message.
MissingResourceException - if the key is not in the bundle.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||