mapToObject /** * map转object的通用方法 * @param map * @param beanClass * @return */ public static Object mapToObject(Map map, Class beanClass) { if (map == null) return null; try { Object obj = beanClass.newInstance(); BeanUtils.popu
/**
* map转object的通用方法
* @param map
* @param beanClass
* @return
*/
public static Object mapToObject(Map
map, Class
beanClass) {
if (map == null)
return null;
try {
Object obj = beanClass.newInstance();
BeanUtils.populate(obj, map);
return obj;
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
}
return null;
}
