## org.apache.batik.script.jacl
Class JaclInterpreter

    java.lang.Object
      org.apache.batik.script.jacl.JaclInterpreter

All Implemented Interfaces:
  Interpreter, Localizable

public class JaclInterpreter
extends java.lang.Object
implements Interpreter

A simple implementation of `Interpreter` interface to use JACL Tcl parser.

Constructor Summary
`JaclInterpreter()`

Method Summary
`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.
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JaclInterpreter

    public JaclInterpreter()

Method Detail

### evaluate

    public java.lang.Object evaluate(java.io.Reader scriptreader)
                              throws InterpreterException,
                                     java.io.IOException

  Description copied from interface: `Interpreter`
  This method should evaluate a piece of script.

  Specified by:
    `evaluate` in interface `Interpreter`
  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`
    `java.io.IOException`

### evaluate

    public java.lang.Object evaluate(java.io.Reader scriptreader,
                                     java.lang.String description)
                              throws java.io.IOException,
                                     InterpreterException

  Description copied from interface: `Interpreter`
  This method should evaluate a piece of script associated to a given description.

  Specified by:
    `evaluate` in interface `Interpreter`
  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:
    `java.io.IOException`
    `InterpreterException`

### evaluate

    public java.lang.Object evaluate(java.lang.String script)
                              throws InterpreterException

  Description copied from interface: `Interpreter`
  This method should evaluate a piece of script using a `String` instead of a `Reader`. This usually allows do easily do some caching.

  Specified by:
    `evaluate` in interface `Interpreter`
  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`

### dispose

    public void dispose()

  Description copied from interface: `Interpreter`
  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.

  Specified by:
    `dispose` in interface `Interpreter`

### bindObject

    public void bindObject(java.lang.String name,
                           java.lang.Object object)

  Description copied from interface: `Interpreter`
  This method should register a particular Java `Object` in the environment of the interpreter.

  Specified by:
    `bindObject` in interface `Interpreter`
  Parameters:
    `name` - the name of the script object to create
    `object` - the Java object

### setOut

    public void setOut(java.io.Writer out)

  Description copied from interface: `Interpreter`
  This method should change the output `Writer` that will be used when output function of the scripting langage is used.

  Specified by:
    `setOut` in interface `Interpreter`
  Parameters:
    `out` - the new out `Writer`.

### getLocale

    public java.util.Locale getLocale()

  Description copied from interface: `Localizable`
  Returns the current locale or null if the locale currently used is the default one.

  Specified by:
    `getLocale` in interface `Localizable`

### setLocale

    public void setLocale(java.util.Locale locale)

  Description copied from interface: `Localizable`
  Provides a way to the user to specify a locale which override the default one. If null is passed to this method, the used locale becomes the global one.

  Specified by:
    `setLocale` in interface `Localizable`
  Parameters:
    `locale` - The locale to set.

### formatMessage

    public java.lang.String formatMessage(java.lang.String key,
                                          java.lang.Object[] args)

  Description copied from interface: `Localizable`
  Creates and returns a localized message, given the key of the message in the resource bundle and the message parameters. The messages in the resource bundle must have the syntax described in the java.text.MessageFormat class documentation.

  Specified by:
    `formatMessage` in interface `Localizable`
  Parameters:
    `key` - The key used to retreive the message from the resource bundle.
    `args` - The objects that compose the message.

Copyright © 2004 Apache Software Foundation. All Rights Reserved.