001    package railo.cli.util;
002    
003    import java.util.Enumeration;
004    import java.util.Iterator;
005    import java.util.Map;
006    import java.util.Set;
007    
008    /**
009     * class to make a enumaration from a ser, map or iterator
010     */
011    public final class EnumerationWrapper implements Enumeration {
012                    
013                    private Iterator it;
014    
015                    /**
016                     * @param map Constructor with a Map
017                     */
018                    public EnumerationWrapper(Map map) {
019                            this(map.keySet().iterator());
020                    }
021                    
022                    /**
023                     * @param set Constructor with a Set
024                     */
025                    public EnumerationWrapper(Set set) {
026                            this(set.iterator());
027                    }
028    
029                    
030                    /**
031                     * @param it Constructor with a iterator
032                     */
033                    public EnumerationWrapper(Iterator it) {
034                            this.it=it;
035                    }
036                    
037    
038                    /**
039                     * @see java.util.Enumeration#hasMoreElements()
040                     */
041                    public boolean hasMoreElements() {
042                            return it.hasNext();
043                    }
044    
045                    /**
046                     * @see java.util.Enumeration#nextElement()
047                     */
048                    public Object nextElement() {
049                            return it.next();
050                    }
051                    
052            }