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.ValueExpression;
23  
24  /**
25   * @author Jacob Hookom
26   * @version $Id$
27   */
28  public final class IterationStatusExpression extends ValueExpression
29  {
30  
31      /**
32       * 
33       */
34      private static final long serialVersionUID = 1L;
35  
36      private final IterationStatus status;
37  
38      /**
39       * 
40       */
41      public IterationStatusExpression(IterationStatus status)
42      {
43          this.status = status;
44      }
45  
46      /*
47       * (non-Javadoc)
48       * 
49       * @see javax.el.ValueExpression#getValue(javax.el.ELContext)
50       */
51      public Object getValue(ELContext context)
52      {
53          return this.status;
54      }
55  
56      /*
57       * (non-Javadoc)
58       * 
59       * @see javax.el.ValueExpression#setValue(javax.el.ELContext, java.lang.Object)
60       */
61      public void setValue(ELContext context, Object value)
62      {
63          throw new UnsupportedOperationException("Cannot set IterationStatus");
64      }
65  
66      /*
67       * (non-Javadoc)
68       * 
69       * @see javax.el.ValueExpression#isReadOnly(javax.el.ELContext)
70       */
71      public boolean isReadOnly(ELContext context)
72      {
73          return true;
74      }
75  
76      /*
77       * (non-Javadoc)
78       * 
79       * @see javax.el.ValueExpression#getType(javax.el.ELContext)
80       */
81      public Class getType(ELContext context)
82      {
83          return IterationStatus.class;
84      }
85  
86      /*
87       * (non-Javadoc)
88       * 
89       * @see javax.el.ValueExpression#getExpectedType()
90       */
91      public Class getExpectedType()
92      {
93          return IterationStatus.class;
94      }
95  
96      /*
97       * (non-Javadoc)
98       * 
99       * @see javax.el.Expression#getExpressionString()
100      */
101     public String getExpressionString()
102     {
103         return this.toString();
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.status.equals(obj);
114     }
115 
116     /*
117      * (non-Javadoc)
118      * 
119      * @see javax.el.Expression#hashCode()
120      */
121     public int hashCode()
122     {
123         return this.status.hashCode();
124     }
125 
126     /*
127      * (non-Javadoc)
128      * 
129      * @see javax.el.Expression#isLiteralText()
130      */
131     public boolean isLiteralText()
132     {
133         return true;
134     }
135 
136     public String toString()
137     {
138         return this.status.toString();
139     }
140 
141 }