%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.commons.jexl.parser.ASTIntegerLiteral |
|
|
1 | /* |
|
2 | * Copyright 2002-2006 The Apache Software Foundation. |
|
3 | * |
|
4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 | * you may not use this file except in compliance with the License. |
|
6 | * You may obtain a copy of the License at |
|
7 | * |
|
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
9 | * |
|
10 | * Unless required by applicable law or agreed to in writing, software |
|
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 | * See the License for the specific language governing permissions and |
|
14 | * limitations under the License. |
|
15 | */ |
|
16 | package org.apache.commons.jexl.parser; |
|
17 | ||
18 | import org.apache.commons.jexl.JexlContext; |
|
19 | ||
20 | /** |
|
21 | * represents an integer. |
|
22 | * |
|
23 | * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a> |
|
24 | * @version $Id: ASTIntegerLiteral.java 398202 2006-04-29 16:40:34Z dion $ |
|
25 | */ |
|
26 | public class ASTIntegerLiteral extends SimpleNode { |
|
27 | /** literal value. */ |
|
28 | protected Integer val; |
|
29 | ||
30 | /** |
|
31 | * Create the node given an id. |
|
32 | * |
|
33 | * @param id node id. |
|
34 | */ |
|
35 | public ASTIntegerLiteral(int id) { |
|
36 | 0 | super(id); |
37 | 0 | } |
38 | ||
39 | /** |
|
40 | * Create a node with the given parser and id. |
|
41 | * |
|
42 | * @param p a parser. |
|
43 | * @param id node id. |
|
44 | */ |
|
45 | public ASTIntegerLiteral(Parser p, int id) { |
|
46 | 156 | super(p, id); |
47 | 156 | } |
48 | ||
49 | /** {@inheritDoc} */ |
|
50 | public Object jjtAccept(ParserVisitor visitor, Object data) { |
|
51 | 0 | return visitor.visit(this, data); |
52 | } |
|
53 | ||
54 | /** |
|
55 | * Part of reference resolution - wierd... in JSTL EL you can have foo.2 |
|
56 | * which is equiv to foo[2] it appears... |
|
57 | * |
|
58 | * @param obj the object to evaluate against. |
|
59 | * @param ctx the {@link JexlContext}. |
|
60 | * @throws Exception on any error. |
|
61 | * @return the resulting value. |
|
62 | * @see ASTArrayAccess#evaluateExpr(Object, Object) |
|
63 | */ |
|
64 | public Object execute(Object obj, JexlContext ctx) throws Exception { |
|
65 | 2 | return ASTArrayAccess.evaluateExpr(obj, val); |
66 | } |
|
67 | ||
68 | /** {@inheritDoc} */ |
|
69 | public Object value(JexlContext jc) throws Exception { |
|
70 | 193 | return val; |
71 | } |
|
72 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |