View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.myfaces.view.facelets.tag.jstl.core;
20  
21  import javax.el.ELContext;
22  import javax.el.PropertyNotWritableException;
23  import javax.el.ValueExpression;
24  
25  /**
26   * @version $Id$
27   */
28  public final class IteratedValueExpression extends ValueExpression
29  {
30  
31      private static final long serialVersionUID = 1L;
32  
33      private ValueExpression orig;
34  
35      private Object value;
36  
37      public IteratedValueExpression(ValueExpression orig, Object value)
38      {
39          this.orig = orig;
40          this.value = value;
41      }
42  
43      /*
44       * (non-Javadoc)
45       * 
46       * @see javax.el.ValueExpression#getValue(javax.el.ELContext)
47       */
48      public Object getValue(ELContext context)
49      {
50          return value;
51      }
52  
53      /*
54       * (non-Javadoc)
55       * 
56       * @see javax.el.ValueExpression#setValue(javax.el.ELContext, java.lang.Object)
57       */
58      public void setValue(ELContext context, Object value)
59      {
60          context.setPropertyResolved(false);
61          throw new PropertyNotWritableException();
62      }
63  
64      /*
65       * (non-Javadoc)
66       * 
67       * @see javax.el.ValueExpression#isReadOnly(javax.el.ELContext)
68       */
69      public boolean isReadOnly(ELContext context)
70      {
71          context.setPropertyResolved(false);
72          return true;
73      }
74  
75      /*
76       * (non-Javadoc)
77       * 
78       * @see javax.el.ValueExpression#getType(javax.el.ELContext)
79       */
80      public Class getType(ELContext context)
81      {
82          context.setPropertyResolved(false);
83          return Object.class;
84      }
85  
86      /*
87       * (non-Javadoc)
88       * 
89       * @see javax.el.ValueExpression#getExpectedType()
90       */
91      public Class getExpectedType()
92      {
93          return Object.class;
94      }
95  
96      /*
97       * (non-Javadoc)
98       * 
99       * @see javax.el.Expression#getExpressionString()
100      */
101     public String getExpressionString()
102     {
103         return this.orig.getExpressionString();
104     }
105 
106     /*
107      * (non-Javadoc)
108      * 
109      * @see javax.el.Expression#equals(java.lang.Object)
110      */
111     public boolean equals(Object obj)
112     {
113         return this.orig.equals(obj);
114     }
115 
116     /*
117      * (non-Javadoc)
118      * 
119      * @see javax.el.Expression#hashCode()
120      */
121     public int hashCode()
122     {
123         return this.orig.hashCode();
124     }
125 
126     /*
127      * (non-Javadoc)
128      * 
129      * @see javax.el.Expression#isLiteralText()
130      */
131     public boolean isLiteralText()
132     {
133         return false;
134     }
135 
136 }