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