标签:resultmap static object stat arraylist array keyset throw map
public static <T> List<T> copyMapToBean(
List<Map<String, Object>> resultMap, Class<T> cls) throws Exception {
if (null == resultMap || resultMap.size() == 0 || null == cls) {
return null;
}
// 结果集
List<T> beanList = new ArrayList<T>();
for (Map<String, Object> map : resultMap) {
T bean = cls.newInstance();
Set<String> keySet = map.keySet();
for (String key : keySet) {
BeanUtils.setProperty(bean, key, map.get(key));
}
beanList.add(bean);
}
return beanList;
}
标签:resultmap static object stat arraylist array keyset throw map
原文地址:http://www.cnblogs.com/tangzeqi/p/7765348.html