org.apache.batik.script.jacl
Class JaclInterpreter

java.lang.Object
  extended by org.apache.batik.script.jacl.JaclInterpreter
All Implemented Interfaces:
org.apache.batik.i18n.Localizable, Interpreter

public class JaclInterpreter
extends Object
implements Interpreter

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

Version:
$Id: JaclInterpreter.java 1733416 2016-03-03 07:07:13Z gadams $
Author:
Christophe Jolif

Constructor Summary
JaclInterpreter()
           
 
Method Summary
 void bindObject(String name, 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.
 Object evaluate(Reader scriptreader)
          This method should evaluate a piece of script.
 Object evaluate(Reader scriptreader, String description)
          This method should evaluate a piece of script associated to a given description.
 Object evaluate(String script)
          This method should evaluate a piece of script using a String instead of a Reader.
 String formatMessage(String key, Object[] args)
           
 Locale getLocale()
           
 String[] getMimeTypes()
          Returns the content types of the scripting languages this interpreter handles.
 void setLocale(Locale locale)
           
 void setOut(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

getMimeTypes

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

Specified by:
getMimeTypes in interface Interpreter

evaluate

public Object evaluate(Reader scriptreader)
                throws 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:
IOException

evaluate

public Object evaluate(Reader scriptreader,
                       String description)
                throws IOException
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:
IOException

evaluate

public Object evaluate(String script)
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

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(String name,
                       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(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 Locale getLocale()
Specified by:
getLocale in interface org.apache.batik.i18n.Localizable

setLocale

public void setLocale(Locale locale)
Specified by:
setLocale in interface org.apache.batik.i18n.Localizable

formatMessage

public String formatMessage(String key,
                            Object[] args)
Specified by:
formatMessage in interface org.apache.batik.i18n.Localizable


Copyright © 2000–2017 Apache Software Foundation. All rights reserved.