View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */ 
17  package org.apache.commons.betwixt.expression;
18  
19  /** <p><code>Expression</code> represents an arbitrary expression on a bean.</p>
20    *
21    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
22    */
23  public interface Expression {
24  
25      /** Evaluates the expression on the bean with the given context
26       * and returns the result 
27       *
28       * @param context evaluate against this <code>Context</code>
29       * @return the value of the expression
30       */
31      public Object evaluate(Context context);    
32      
33      
34      /* XXX 
35         Is update actually useful?
36         None of the expression implementations i can find do anything when it's called.
37         I suspect that it's been replaced by Updater
38         but i maybe i'm missing something subtle
39      */
40      /** <p>Updates the current bean context with a new String value.
41       * This is typically used when parsing XML and updating a beans value
42       * from XML.<p>
43       *
44       * @param context update this <code>Context</code> 
45       * @param newValue the new value for this expression
46       * @deprecated 0.5 use {@link Updater} instead
47       */
48      public void update(Context context, String newValue);
49  }