View Javadoc

1   /*
2    * Copyright 2004 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.portals.bridges.jsf;
17  
18  import java.util.Enumeration;
19  
20  /***
21   * <p>
22   * Enumeration without elements
23   * </p>
24   * <p>
25   * Code provided by MyFaces project.
26   * </p>
27   * 
28   * @author <a href="dlestrat@apache.org">David Le Strat </a>
29   */
30  public final class NullEnumeration implements Enumeration
31  {
32      /*** Null enumeration. */
33      private static final NullEnumeration nullEnumeration = new NullEnumeration();
34  
35      /***
36       * @return An instance of the enumeration.
37       */
38      public static final NullEnumeration instance()
39      {
40          return nullEnumeration;
41      }
42  
43      /***
44       * @see java.util.Enumeration#hasMoreElements()
45       */
46      public boolean hasMoreElements()
47      {
48          return false;
49      }
50  
51      /***
52       * @see java.util.Enumeration#nextElement()
53       */
54      public Object nextElement()
55      {
56          throw new UnsupportedOperationException("NullEnumeration has no elements");
57      }
58  }