1 package jodd.bean.loaders; 2 3 import java.util.Iterator; 4 import java.util.Map; 5 6 import jodd.bean.BeanUtil; 7 8 15 public class MapLoader implements jodd.bean.Loader { 16 17 public void load(Object bean, Object map) { 18 if (map instanceof Map) { 19 Iterator i = ((Map)map).keySet().iterator(); 20 while (i.hasNext()) { 21 String propertyName = (String) i.next(); 22 Object propertyValue = ((Map)map).get(propertyName); 23 if (propertyValue == null) { 24 return; 25 } 26 BeanUtil.setProperty(bean, propertyName, propertyValue); 27 } 28 } 29 } 30 } 31 | Popular Tags |