1 17 18 19 package org.apache.naming; 20 21 import java.util.Iterator ; 22 23 import javax.naming.NameClassPair ; 24 import javax.naming.NamingEnumeration ; 25 import javax.naming.NamingException ; 26 27 33 34 public class NamingContextEnumeration 35 implements NamingEnumeration { 36 37 38 40 41 public NamingContextEnumeration(Iterator entries) { 42 iterator = entries; 43 } 44 45 46 48 49 52 protected Iterator iterator; 53 54 55 57 58 61 public Object next() 62 throws NamingException { 63 return nextElement(); 64 } 65 66 67 70 public boolean hasMore() 71 throws NamingException { 72 return iterator.hasNext(); 73 } 74 75 76 79 public void close() 80 throws NamingException { 81 } 82 83 84 public boolean hasMoreElements() { 85 return iterator.hasNext(); 86 } 87 88 89 public Object nextElement() { 90 NamingEntry entry = (NamingEntry) iterator.next(); 91 return new NameClassPair (entry.name, entry.value.getClass().getName()); 92 } 93 94 95 } 96 97 | Popular Tags |