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.el;
018    
019    import javax.servlet.jsp.el.ELException;
020    import javax.servlet.jsp.el.FunctionMapper;
021    import javax.servlet.jsp.el.VariableResolver;
022    
023    /**
024     *
025     * <p>The abstract class from which all expression types
026     * derive.
027     * 
028     * @author Nathan Abramson - Art Technology Group
029     * @author Shawn Bayern
030     * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: bayard $
031     **/
032    
033    public abstract class Expression
034    {
035      //-------------------------------------
036      // Member variables
037      //-------------------------------------
038    
039      //-------------------------------------
040      /**
041       *
042       * Returns the expression in the expression language syntax
043       **/
044      public abstract String getExpressionString ();
045    
046      //-------------------------------------
047      /**
048       *
049       * Evaluates the expression in the given context
050       **/
051      public abstract Object evaluate (VariableResolver pResolver, FunctionMapper functions)
052        throws ELException;
053    
054      //-------------------------------------
055    
056      /**
057       * Returns an expression with all <code>FunctionInvocation</code>s replaced by
058       * <code>BoundFunctionInvocation</code>s.
059       * @param functions the functions to use in this transformation
060       * @return an Expression identical to this expression except with all
061       *    <code>FunctionInvocation</code>s replaced by
062       *    <code>BoundFunctionInvocation</code>s.
063       * @throws ELException if any of the functions in this <code>Expression</code> are
064       *    not present in <code>functions</code>
065       */
066      public abstract Expression bindFunctions(FunctionMapper functions)
067          throws ELException;
068    
069    }