📄 maploader.java
字号:
package jodd.bean.loaders;
import java.util.Iterator;
import java.util.Map;
import jodd.bean.BeanUtil;
/**
* Populate java bean using objects that are implementation of Map interface.
* <p>
* Properties in Map object are defined as follows:
* each key of Map object is a string the represents a bean property name and
* keys value is an object that represents bean property value.
*/
public class MapLoader implements jodd.bean.Loader {
public void load(Object bean, Object map) {
if (map instanceof Map) {
Iterator i = ((Map)map).keySet().iterator();
while (i.hasNext()) {
String propertyName = (String) i.next();
Object propertyValue = ((Map)map).get(propertyName);
if (propertyValue == null) {
return;
}
BeanUtil.setProperty(bean, propertyName, propertyValue);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -