1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.betwixt.expression;
18
19 /*** <p><code>EmptyExpression</code> returns the same value as is passed in. </p>
20 *
21 * <p> See {@link #evaluate}. </p>
22 *
23 * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
24 * @version $Revision: 438373 $
25 */
26 public class EmptyExpression implements Expression {
27
28 /*** Don't need more than one <code>EmptyExpression</code>*/
29 private static final EmptyExpression singleton = new EmptyExpression();
30
31 /***
32 * Gets the singleton instance.
33 * @return the EmptyExpression singleton.
34 */
35 public static EmptyExpression getInstance() {
36 return singleton;
37 }
38
39 /*** Should this be private?
40 */
41 public EmptyExpression() {
42 }
43
44 /*** Return the bean we're evaluating.
45 * @see org.apache.commons.betwixt.expression.Expression
46 */
47 public Object evaluate(Context context) {
48 return context.getBean();
49 }
50
51 /*** Do nothing
52 * @see org.apache.commons.betwixt.expression.Expression
53 */
54 public void update(Context context, String newValue) {
55
56 }
57
58 /***
59 * Return something useful for logging.
60 * @return short name for this class
61 */
62 public String toString() {
63 return "EmptyExpression";
64 }
65
66 }