1 25 26 package org.objectweb.easybeans.naming.context; 27 28 import java.util.Enumeration ; 29 import java.util.Hashtable ; 30 import java.util.NoSuchElementException ; 31 32 import javax.naming.Binding ; 33 import javax.naming.NamingEnumeration ; 34 import javax.naming.NamingException ; 35 36 40 public class BindingsImpl implements NamingEnumeration <Binding > { 41 42 45 private Enumeration names; 46 47 50 private Hashtable bindings; 51 52 56 public BindingsImpl(final Hashtable bindings) { 57 this.bindings = bindings; 58 this.names = bindings.keys(); 59 } 60 61 72 public Binding next() throws NamingException { 73 String name = (String ) names.nextElement(); 74 return new Binding (name, bindings.get(name)); 75 } 76 77 82 public Binding nextElement() { 83 try { 84 return next(); 85 } catch (NamingException e) { 86 throw new NoSuchElementException (e.toString()); 87 } 88 } 89 90 97 public boolean hasMore() throws NamingException { 98 return names.hasMoreElements(); 99 } 100 101 104 public void close() { 105 } 106 107 113 public boolean hasMoreElements() { 114 try { 115 return hasMore(); 116 } catch (NamingException e) { 117 return false; 118 } 119 } 120 121 } 122 | Popular Tags |