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      private static final long serialVersionUID = 1L;
32  
33      private final IterationStatus status;
34  
35      public IterationStatusExpression(IterationStatus status)
36      {
37          this.status = status;
38      }
39  
40      @Override
41      public Object getValue(ELContext context)
42      {
43          return this.status;
44      }
45  
46      @Override
47      public void setValue(ELContext context, Object value)
48      {
49          throw new UnsupportedOperationException("Cannot set IterationStatus");
50      }
51  
52      @Override
53      public boolean isReadOnly(ELContext context)
54      {
55          return true;
56      }
57  
58      @Override
59      public Class getType(ELContext context)
60      {
61          return IterationStatus.class;
62      }
63  
64      @Override
65      public Class getExpectedType()
66      {
67          return IterationStatus.class;
68      }
69  
70      @Override
71      public String getExpressionString()
72      {
73          return this.toString();
74      }
75  
76      @Override
77      public boolean equals(Object obj)
78      {
79          return this.status.equals(obj);
80      }
81  
82      @Override
83      public int hashCode()
84      {
85          return this.status.hashCode();
86      }
87  
88      @Override
89      public boolean isLiteralText()
90      {
91          return true;
92      }
93  
94      @Override
95      public String toString()
96      {
97          return this.status.toString();
98      }
99  
100 }