1 24 package org.riotfamily.common.beans; 25 26 import java.util.ArrayList ; 27 import java.util.Iterator ; 28 import java.util.List ; 29 import java.util.Map ; 30 31 import org.springframework.beans.factory.config.AbstractFactoryBean; 32 33 public class KeyValueListFactoryBean extends AbstractFactoryBean { 34 35 private List list; 36 37 public void setEntries(Map entries) { 38 list = new ArrayList (entries.size()); 39 Iterator it = entries.entrySet().iterator(); 40 while (it.hasNext()) { 41 Map.Entry entry = (Map.Entry ) it.next(); 42 list.add(new KeyValueBean(entry.getKey(), entry.getValue())); 43 } 44 } 45 46 protected Object createInstance() throws Exception { 47 return list; 48 } 49 50 public Class getObjectType() { 51 return List .class; 52 } 53 54 55 56 57 } 58 | Popular Tags |