001 package railo.runtime.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 * Constructor of the class 031 * @param objs 032 */ 033 public EnumerationWrapper(Object[] objs) { 034 this(new ArrayIterator(objs)); 035 } 036 037 /** 038 * @param it Constructor with a iterator 039 */ 040 public EnumerationWrapper(Iterator it) { 041 this.it=it; 042 } 043 044 045 /** 046 * @see java.util.Enumeration#hasMoreElements() 047 */ 048 public boolean hasMoreElements() { 049 return it.hasNext(); 050 } 051 052 /** 053 * @see java.util.Enumeration#nextElement() 054 */ 055 public Object nextElement() { 056 return it.next(); 057 } 058 059 }