MCPcopy Create free account
hub / github.com/Bit0r/java-util / mapToBean

Method mapToBean

src/main/java/util/CommonUtils.java:327–332  ·  view source on GitHub ↗

将map集合中的数据转化为指定对象的同名属性中

(Map<String, Object> map, Class<T> clazz)

Source from the content-addressed store, hash-verified

325 * 将map集合中的数据转化为指定对象的同名属性中
326 */
327 public static <T> T mapToBean(Map<String, Object> map, Class<T> clazz) throws Exception {
328 T bean = clazz.newInstance();
329 BeanMap beanMap = BeanMap.create(bean);
330 beanMap.putAll(map);
331 return bean;
332 }
333
334 /**
335 * 如果返回null则表示没有错误

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected