1 22 package org.objectweb.petals.jbi.registry.mock; 23 24 import java.util.ArrayList ; 25 import java.util.List ; 26 27 import javax.naming.NamingEnumeration ; 28 import javax.naming.NamingException ; 29 30 35 public class MockNamingEnumeration<T> implements NamingEnumeration { 36 37 private List <T> elems = new ArrayList <T>(); 38 39 private int pos = 0; 40 41 public Object next() throws NamingException { 42 return elems.get(pos++); 43 } 44 45 public boolean hasMore() throws NamingException { 46 return pos < elems.size(); 47 } 48 49 public void close() throws NamingException { 50 } 51 52 public boolean hasMoreElements() { 53 return pos < elems.size(); 54 } 55 56 public Object nextElement() { 57 return elems.get(pos++); 58 } 59 60 public List <T> getElems() { 61 return elems; 62 } 63 64 public void setElems(List <T> elems) { 65 this.elems = elems; 66 } 67 68 public int getPos() { 69 return pos; 70 } 71 72 public void setPos(int pos) { 73 this.pos = pos; 74 } 75 76 } 77 | Popular Tags |