01: /*
02: * %W% %E% %U%
03: *
04: * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
05: * SUN PROPRIETARY/CONFIDENTAIL. Use is subject to license terms.
06: */
07:
08: package javax.script;
09:
10: import java.util.Map;
11: import java.io.Reader;
12:
13: /**
14: * The optional interface implemented by ScriptEngines whose methods compile scripts
15: * to a form that can be executed repeatedly without recompilation.
16: *
17: * @author Mike Grogan
18: * @version 1.0
19: * @since 1.6
20: */
21: public interface Compilable {
22: /**
23: * Compiles the script (source represented as a <code>String</code>) for
24: * later execution.
25: *
26: * @param script The source of the script, represented as a <code>String</code>.
27: *
28: * @return An subclass of <code>CompiledScript</code> to be executed later using one
29: * of the <code>eval</code> methods of <code>CompiledScript</code>.
30: *
31: * @throws <code>ScriptException</code> if compilation fails.
32: * @throws <code>NullPointerException</code> if the argument is null.
33: *
34: */
35:
36: public CompiledScript compile(String script) throws ScriptException;
37:
38: /**
39: * Compiles the script (source read from <code>Reader</code>) for
40: * later execution. Functionality is identical to
41: * <code>compile(String)</code> other than the way in which the source is
42: * passed.
43: *
44: * @param script The reader from which the script source is obtained.
45: *
46: * @return An implementation of <code>CompiledScript</code> to be executed
47: * later using one of its <code>eval</code> methods of <code>CompiledScript</code>.
48: *
49: * @throws <code>ScriptException</code> if compilation fails.
50: * @throws <code>NullPointerException</code> if argument is null.
51: */
52: public CompiledScript compile(Reader script) throws ScriptException;
53: }
|