1 17 18 19 package org.apache.naming.resources; 20 21 import java.util.Enumeration ; 22 import java.util.Vector ; 23 24 import javax.naming.NamingEnumeration ; 25 import javax.naming.NamingException ; 26 27 33 34 public class RecyclableNamingEnumeration 35 implements NamingEnumeration { 36 37 38 40 41 public RecyclableNamingEnumeration(Vector entries) { 42 this.entries = entries; 43 recycle(); 44 } 45 46 47 49 50 53 protected Vector entries; 54 55 56 59 protected Enumeration enumeration; 60 61 62 64 65 68 public Object next() 69 throws NamingException { 70 return nextElement(); 71 } 72 73 74 77 public boolean hasMore() 78 throws NamingException { 79 return enumeration.hasMoreElements(); 80 } 81 82 83 86 public void close() 87 throws NamingException { 88 } 89 90 91 public boolean hasMoreElements() { 92 return enumeration.hasMoreElements(); 93 } 94 95 96 public Object nextElement() { 97 return enumeration.nextElement(); 98 } 99 100 101 103 104 107 void recycle() { 108 enumeration = entries.elements(); 109 } 110 111 112 } 113 114 | Popular Tags |