KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > servlet > jsp > jstl > core > IteratedValueExpression


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  *
21  * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package javax.servlet.jsp.jstl.core;
25
26 import javax.el.ELContext;
27 import javax.el.ValueExpression;
28
29 /**
30  * @author Kin-man Chung
31  * @version $Id: IteratedValueExpression.java,v 1.2 2005/12/08 01:20:43 kchung Exp $
32  */

33 public final class IteratedValueExpression extends ValueExpression {
34
35     private static final long serialVersionUID = 1L;
36     protected final int i;
37     protected final IteratedExpression iteratedExpression;
38
39     public IteratedValueExpression(IteratedExpression iteratedExpr, int i) {
40         this.i = i;
41         this.iteratedExpression = iteratedExpr;
42     }
43
44     public Object JavaDoc getValue(ELContext context) {
45         return iteratedExpression.getItem(context, i);
46     }
47
48     public void setValue(ELContext context, Object JavaDoc value) {
49     }
50
51     public boolean isReadOnly(ELContext context) {
52         return true;
53     }
54
55     public Class JavaDoc getType(ELContext context) {
56         return null;
57     }
58
59     public Class JavaDoc getExpectedType() {
60         return Object JavaDoc.class;
61     }
62
63     public String JavaDoc getExpressionString() {
64         return iteratedExpression.getValueExpression().getExpressionString();
65     }
66
67     public boolean equals(Object JavaDoc obj) {
68         return iteratedExpression.getValueExpression().equals(obj);
69     }
70
71     public int hashCode() {
72         return iteratedExpression.getValueExpression().hashCode();
73     }
74
75     public boolean isLiteralText() {
76         return false;
77     }
78 }
79
80
Popular Tags