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.betwixt.expression;
018    
019    /** <p><code>Expression</code> represents an arbitrary expression on a bean.</p>
020      *
021      * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
022      */
023    public interface Expression {
024    
025        /** Evaluates the expression on the bean with the given context
026         * and returns the result 
027         *
028         * @param context evaluate against this <code>Context</code>
029         * @return the value of the expression
030         */
031        public Object evaluate(Context context);    
032        
033        
034        /* XXX 
035           Is update actually useful?
036           None of the expression implementations i can find do anything when it's called.
037           I suspect that it's been replaced by Updater
038           but i maybe i'm missing something subtle
039        */
040        /** <p>Updates the current bean context with a new String value.
041         * This is typically used when parsing XML and updating a beans value
042         * from XML.<p>
043         *
044         * @param context update this <code>Context</code> 
045         * @param newValue the new value for this expression
046         * @deprecated 0.5 use {@link Updater} instead
047         */
048        public void update(Context context, String newValue);
049    }