001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.commons.jexl2;
018
019 /**
020 * <p>A JEXL Script.</p>
021 * <p>A script is some valid JEXL syntax to be executed with
022 * a given set of {@link JexlContext} variabless.</p>
023 * <p>A script is a group of statements, separated by semicolons.</p>
024 * <p>The statements can be <code>blocks</code> (curly braces containing code),
025 * Control statements such as <code>if</code> and <code>while</code>
026 * as well as expressions and assignment statements.</p>
027 *
028 * @since 1.1
029 */
030 public interface Script {
031 /**
032 * Executes the script with the variables contained in the
033 * supplied {@link JexlContext}.
034 *
035 * @param context A JexlContext containing variables.
036 * @return The result of this script, usually the result of
037 * the last statement.
038 */
039 Object execute(JexlContext context);
040
041 /**
042 * Returns the text of this Script.
043 * @return The script to be executed.
044 */
045 String getText();
046
047 }