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