1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.jexl.parser;
17
18 import org.apache.commons.jexl.JexlContext;
19
20 /***
21 * Simple testcases
22 *
23 * @author <a href="mailto:mhw@kremvax.net">Mark H. Wilkinson</a>
24 * @version $Id: ASTSizeMethod.java,v 1.3 2004/02/28 13:45:20 yoavs Exp $
25 */
26 public class ASTSizeMethod extends SimpleNode
27 {
28 public ASTSizeMethod(int id)
29 {
30 super(id);
31 }
32
33 public ASTSizeMethod(Parser p, int id)
34 {
35 super(p, id);
36 }
37
38 /*** Accept the visitor. **/
39 public Object jjtAccept(ParserVisitor visitor, Object data)
40 {
41 return visitor.visit(this, data);
42 }
43
44 /***
45 * returns the value of itself applied to the object.
46 * We assume that an identifier can be gotten via a get(String)
47 */
48 public Object execute(Object obj, JexlContext jc)
49 throws Exception
50 {
51 return new Integer(ASTSizeFunction.sizeOf(obj));
52 }
53
54 }