Interface Interpreter

All Superinterfaces:
Localizable
All Known Implementing Classes:
RhinoInterpreter, SVG12RhinoInterpreter

public interface Interpreter extends Localizable
A high level interface that represents an interpreter engine for a particular scripting language.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    bindObject(String name, Object object)
    This method should register a particular Java Object in the environment of the interpreter.
    void
    This method can dispose resources used by the interpreter when it is no longer used.
    evaluate(Reader scriptreader)
    This method should evaluate a piece of script.
    evaluate(Reader scriptreader, String description)
    This method should evaluate a piece of script associated to a given description.
    evaluate(String script)
    This method should evaluate a piece of script using a String instead of a Reader.
    Returns the content types of the scripting languages this interpreter handles.
    void
    setOut(Writer output)
    This method should change the output Writer that 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 Details

    • getMimeTypes

      String[] getMimeTypes()
      Returns the content types of the scripting languages this interpreter handles.
    • evaluate

      Object evaluate(Reader scriptreader, String description) throws InterpreterException, IOException
      This method should evaluate a piece of script associated to a given description.
      Parameters:
      scriptreader - a java.io.Reader on the piece of script
      description - 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:
      InterpreterException
      IOException
    • evaluate

      Object evaluate(Reader scriptreader) throws InterpreterException, IOException
      This method should evaluate a piece of script.
      Parameters:
      scriptreader - a java.io.Reader on 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
      IOException
    • evaluate

      Object evaluate(String script) throws InterpreterException
      This method should evaluate a piece of script using a String instead of a Reader. 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(String name, Object object)
      This method should register a particular Java Object in the environment of the interpreter.
      Parameters:
      name - the name of the script object to create
      object - the Java object
    • setOut

      void setOut(Writer output)
      This method should change the output Writer that will be used when output function of the scripting langage is used.
      Parameters:
      output - the new out Writer.
    • 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.