01: /*
02: * Copyright 2004 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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.myfaces.shared_impl.util;
17:
18: import java.util.Enumeration;
19: import java.util.NoSuchElementException;
20:
21: /**
22: * Enumeration without elements
23: *
24: * @author Anton Koinov (latest modification by $Author: mbr $)
25: * @version $Revision: 512337 $ $Date: 2007-02-27 18:45:44 +0100 (Di, 27 Feb 2007) $
26: */
27: public final class NullEnumeration implements Enumeration {
28: private static final NullEnumeration s_nullEnumeration = new NullEnumeration();
29:
30: public static final NullEnumeration instance() {
31: return s_nullEnumeration;
32: }
33:
34: public boolean hasMoreElements() {
35: return false;
36: }
37:
38: public Object nextElement() {
39: throw new NoSuchElementException(
40: "NullEnumeration has no elements");
41: }
42: }
|