Package org.apache.batik.script
Interface Interpreter
-
- All Superinterfaces:
Localizable
- All Known Implementing Classes:
JPythonInterpreter,RhinoInterpreter,SVG12RhinoInterpreter
public interface Interpreter extends Localizable
A high level interface that represents an interpreter engine for a particular scripting language.- Version:
- $Id: Interpreter.java 1733416 2016-03-03 07:07:13Z gadams $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidbindObject(java.lang.String name, java.lang.Object object)This method should register a particular JavaObjectin the environment of the interpreter.voiddispose()This method can dispose resources used by the interpreter when it is no longer used.java.lang.Objectevaluate(java.io.Reader scriptreader)This method should evaluate a piece of script.java.lang.Objectevaluate(java.io.Reader scriptreader, java.lang.String description)This method should evaluate a piece of script associated to a given description.java.lang.Objectevaluate(java.lang.String script)This method should evaluate a piece of script using aStringinstead of aReader.java.lang.String[]getMimeTypes()Returns the content types of the scripting languages this interpreter handles.voidsetOut(java.io.Writer output)This method should change the outputWriterthat will be used when output function of the scripting langage is used.-
Methods inherited from interface org.apache.batik.i18n.Localizable
formatMessage, getLocale, setLocale
-
-
-
-
Method Detail
-
getMimeTypes
java.lang.String[] getMimeTypes()
Returns the content types of the scripting languages this interpreter handles.
-
evaluate
java.lang.Object evaluate(java.io.Reader scriptreader, java.lang.String description) throws InterpreterException, java.io.IOExceptionThis method should evaluate a piece of script associated to a given description.- Parameters:
scriptreader- ajava.io.Readeron the piece of scriptdescription- description which can be later used (e.g., for error messages).- Returns:
- if no exception is thrown during the call, should return the value of the last expression evaluated in the script
- Throws:
InterpreterExceptionjava.io.IOException
-
evaluate
java.lang.Object evaluate(java.io.Reader scriptreader) throws InterpreterException, java.io.IOExceptionThis method should evaluate a piece of script.- Parameters:
scriptreader- ajava.io.Readeron the piece of script- Returns:
- if no exception is thrown during the call, should return the value of the last expression evaluated in the script
- Throws:
InterpreterExceptionjava.io.IOException
-
evaluate
java.lang.Object evaluate(java.lang.String script) throws InterpreterExceptionThis method should evaluate a piece of script using aStringinstead of aReader. This usually allows do easily do some caching.- Parameters:
script- the piece of script- Returns:
- if no exception is thrown during the call, should return the value of the last expression evaluated in the script
- Throws:
InterpreterException
-
bindObject
void bindObject(java.lang.String name, java.lang.Object object)This method should register a particular JavaObjectin the environment of the interpreter.- Parameters:
name- the name of the script object to createobject- the Java object
-
setOut
void setOut(java.io.Writer output)
This method should change the outputWriterthat will be used when output function of the scripting langage is used.- Parameters:
output- the new outWriter.
-
dispose
void dispose()
This method can dispose resources used by the interpreter when it is no longer used. Be careful, you SHOULD NOT use this interpreter instance after calling this method.
-
-