KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > script > Compilable


1 /*
2  * @(#)Compilable.java 1.3 05/11/17 14:24:13
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTAIL. Use is subject to license terms.
6  */

7
8 package javax.script;
9
10 import java.util.Map JavaDoc;
11 import java.io.Reader JavaDoc;
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 ScriptException if compilation fails.
32      * @throws NullPointerException if the argument is null.
33      *
34      */

35     
36     public CompiledScript compile(String JavaDoc script) throws
37             ScriptException;
38     
39     /**
40      * Compiles the script (source read from <code>Reader</code>) for
41      * later execution. Functionality is identical to
42      * <code>compile(String)</code> other than the way in which the source is
43      * passed.
44      *
45      * @param script The reader from which the script source is obtained.
46      *
47      * @return An implementation of <code>CompiledScript</code> to be executed
48      * later using one of its <code>eval</code> methods of <code>CompiledScript</code>.
49      *
50      * @throws ScriptException if compilation fails.
51      * @throws NullPointerException if argument is null.
52      */

53     public CompiledScript compile(Reader JavaDoc script) throws
54             ScriptException;
55 }
56
Popular Tags