1 26 27 package org.objectweb.util.explorer.plugin.java; 28 29 import java.util.Collection ; 30 import java.util.Iterator ; 31 import java.util.List ; 32 import java.util.Vector ; 33 34 import org.objectweb.util.explorer.api.Context; 35 import org.objectweb.util.explorer.api.Entry; 36 import org.objectweb.util.explorer.core.naming.lib.DefaultEntry; 37 38 46 public class CollectionContext 47 implements Context 48 { 49 50 56 62 68 74 77 public Entry[] getEntries(Object object) { 78 Collection collection = (Collection )object; 79 List entryList = new Vector (); 80 Iterator iterator = collection.iterator(); 81 int cpt = 1; 82 while (iterator.hasNext()) { 83 Object element = iterator.next(); 84 entryList.add(new DefaultEntry(element + " (" + cpt + ")", element)); 85 cpt++; 86 } 87 return (Entry[])entryList.toArray(new Entry[0]); 88 } 89 90 } | Popular Tags |