1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  package org.apache.commons.jexl;
17  
18  /***
19   * <p>A JEXL Script.</p>
20   * <p>A script is some valid JEXL syntax to be executed with
21   * a given set of {@link JexlContext variables}.</p>
22   * <p>A script is a group of statements, separated by semicolons.</p>
23   * <p>The statements can be <code>blocks</code> (curly braces containing code),
24   * Control statements such as <code>if</code> and <code>while</code>
25   * as well as expressions and assignment statements.</p>
26   *  
27   * @since 1.1
28   */
29  public interface Script {
30      /***
31       * Executes the script with the variables contained in the
32       * supplied {@link JexlContext}. 
33       * 
34       * @param context A JexlContext containing variables.
35       * @return The result of this script, usually the result of 
36       *      the last statement.
37       * @throws Exception on any script parse or execution error.
38       */
39      Object execute(JexlContext context) throws Exception;
40  
41      /***
42       * Returns the text of this Script.
43       * @return The script to be executed.
44       */
45      String getText();
46  
47  }