org.apache.batik.script.Interpreter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of batik-script Show documentation
Show all versions of batik-script Show documentation
Batik script language support
The newest version!
/*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.apache.batik.script;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
/**
* A high level interface that represents an interpreter engine for
* a particular scripting language.
*
* @author Christophe Jolif
* @version $Id$
*/
public interface Interpreter extends org.apache.batik.i18n.Localizable {
/**
* Returns the content types of the scripting languages this interpreter
* handles.
*/
String[] getMimeTypes();
/**
* This method should evaluate a piece of script associated to a given
* description.
*
* @param scriptreader a java.io.Reader
on the piece of script
* @param description description which can be later used (e.g., for error
* messages).
* @return if no exception is thrown during the call, should return the
* value of the last expression evaluated in the script
*/
Object evaluate(Reader scriptreader, String description)
throws InterpreterException, IOException;
/**
* This method should evaluate a piece of script.
*
* @param scriptreader a java.io.Reader
on the piece of script
* @return if no exception is thrown during the call, should return the
* value of the last expression evaluated in the script
*/
Object evaluate(Reader scriptreader)
throws InterpreterException, IOException;
/**
* This method should evaluate a piece of script using a String
* instead of a Reader
. This usually allows do easily do some
* caching.
*
* @param script the piece of script
* @return if no exception is thrown during the call, should return the
* value of the last expression evaluated in the script
*/
Object evaluate(String script)
throws InterpreterException;
/**
* This method should register a particular Java Object
in
* the environment of the interpreter.
*
* @param name the name of the script object to create
* @param object the Java object
*/
void bindObject(String name, Object object);
/**
* This method should change the output Writer
that will be
* used when output function of the scripting langage is used.
*
* @param output the new out Writer
.
*/
void setOut(Writer output);
/**
* 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.
*/
void dispose();
}