01: /*
02: * Copyright 2002-2006 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
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: }
|