1 16 17 package org.apache.naming.util; 18 19 import java.util.Enumeration; 20 import java.util.Vector; 21 22 import javax.naming.NamingEnumeration; 23 import javax.naming.NamingException; 24 25 31 32 public class RecyclableNamingEnumeration 33 implements NamingEnumeration { 34 35 36 38 39 public RecyclableNamingEnumeration(Vector entries) { 40 this.entries = entries; 41 recycle(); 42 } 43 44 45 47 48 51 protected Vector entries; 52 53 54 57 protected Enumeration enum; 58 59 60 62 63 66 public Object next() 67 throws NamingException { 68 return nextElement(); 69 } 70 71 72 75 public boolean hasMore() 76 throws NamingException { 77 return enum.hasMoreElements(); 78 } 79 80 81 84 public void close() 85 throws NamingException { 86 } 87 88 89 public boolean hasMoreElements() { 90 return enum.hasMoreElements(); 91 } 92 93 94 public Object nextElement() { 95 return enum.nextElement(); 96 } 97 98 99 101 102 105 void recycle() { 106 enum = entries.elements(); 107 } 108 109 110 } 111 112 | Popular Tags |