1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org/apache/commons/betwixt/expression/package-summary.html">> org.apache.commons.betwixt.expression;
17
18
19 /*** <p><code>ClassNameExpression</code> returns the current class name
20 * of the context bean
21 *
22 * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
23 * @since 0.5
24 */
25 public class ClassNameExpression implements Expression {
26
27 /*** Base constructor */
28 public ClassNameExpression() {
29 }
30
31 /***
32 * Evaluate on the current context and return the class name
33 *
34 * @param context the context against which this expression will be evaluated
35 * @return the name of the class of the current contex bean
36 */
37 public Object evaluate(Context context) {
38 Object bean = context.getBean();
39 if ( bean != null ) {
40 return bean.getClass().getName();
41 }
42 return null;
43 }
44
45 /***
46 * Do nothing.
47 * @see org.apache.commons.betwixt.expression.Expression
48 */
49 public void update(Context context, String newValue) {
50
51 }
52
53 /***
54 * Returns something useful for logging.
55 * @return something useful for logging
56 */
57 public String toString() {
58 return "ClassNameExpression";
59 }
60 }