1 26 27 package org.objectweb.util.browser.plugin.java.map; 28 29 import org.objectweb.util.browser.api.Context; 30 import org.objectweb.util.browser.api.Entry; 31 import org.objectweb.util.browser.api.Wrapper; 32 import org.objectweb.util.browser.core.naming.DefaultEntry; 33 import org.objectweb.util.browser.core.naming.DefaultName; 34 35 43 public class MapContext 44 implements Wrapper, Context 45 { 46 47 53 54 protected java.util.Map map_; 55 56 62 68 74 77 public void setWrapped(Object object) 78 { 79 map_ = (java.util.Map )object; 80 } 81 82 85 public Object getWrapped() 86 { 87 return map_; 88 } 89 90 96 100 public Entry[] getEntries() 101 { 102 Entry[] entries = new Entry[map_.size()]; 104 105 Object [] keys = map_.keySet().toArray(); 107 Object [] elements = map_.values().toArray(); 108 for (int i = 0; i < entries.length; i++) 109 { 110 entries[i] = 111 new DefaultEntry(elements[i], new DefaultName(keys[i].toString()), this); 112 } 113 return entries; 114 } 115 116 } | Popular Tags |