@Test public void getMapToBeansTest() { List<Map<String, Object>> list = new ArrayList<Map<String, Object>>() { private static final long serialVersionUID = 1L; { add(new HashMap<String, Object>() { private static final long serialVersionUID = 1L; { put("id", "id0"); put("name", "name0"); } }); } }; List<UseEntity> entityList = UseEntity.mapToBeans(list, UseEntity.class); assertNotNull(entityList); assertEquals(1, entityList.size()); assertEquals("id0", entityList.get(0).getId()); assertEquals("name0", entityList.get(0).getName()); }
public static <T extends BaseEntity> List<T> mapToBeans(final List<Map<String, Object>> beanMaps, final Class<T> beanType) { if (CollectionUtils.isEmpty(beanMaps)) { return Collections.emptyList(); } final List<T> beans = new ArrayList<>(beanMaps.size()); for (Map<String, Object> beanMap : beanMaps) { beans.add(mapToBean(beanMap, beanType)); } return beans; }
BaseEntity implements Cloneable, Serializable { public static <T extends BaseEntity> List<T> mapToBeans(final List<Map<String, Object>> beanMaps, final Class<T> beanType) { if (CollectionUtils.isEmpty(beanMaps)) { return Collections.emptyList(); } final List<T> beans = new ArrayList<>(beanMaps.size()); for (Map<String, Object> beanMap : beanMaps) { beans.add(mapToBean(beanMap, beanType)); } return beans; } }
BaseEntity implements Cloneable, Serializable { public static <T extends BaseEntity> List<T> mapToBeans(final List<Map<String, Object>> beanMaps, final Class<T> beanType) { if (CollectionUtils.isEmpty(beanMaps)) { return Collections.emptyList(); } final List<T> beans = new ArrayList<>(beanMaps.size()); for (Map<String, Object> beanMap : beanMaps) { beans.add(mapToBean(beanMap, beanType)); } return beans; }  }
BaseEntity implements Cloneable, Serializable { public static <T extends BaseEntity> List<T> mapToBeans(final List<Map<String, Object>> beanMaps, final Class<T> beanType) { if (CollectionUtils.isEmpty(beanMaps)) { return Collections.emptyList(); } final List<T> beans = new ArrayList<>(beanMaps.size()); for (Map<String, Object> beanMap : beanMaps) { beans.add(mapToBean(beanMap, beanType)); } return beans; }  String[] attributeNames(); @SuppressWarnings("unchecked") T attributeValue(final String fieldName); T attributeValue(final String fieldName, final T defaultValue); void setAttributeValue(final String fieldName, final Object value); void setAttributeValue(final String fieldName, final Object value, final boolean isCase); Map<String, Object> beanToMap(); static T mapToBean(Map<String, Object> beanMap, Class<T> beanType); static List<T> mapToBeans(final List<Map<String, Object>> beanMaps, final Class<T> beanType); static Map<String, Method> paramMethods(Class<?> cls); static Map<String, Field> paramFields(Class<?> cls); Collection<Method> methods(); Collection<Field> fields(); @Override BaseEntity clone(); @Override String toString(); }
BaseEntity implements Cloneable, Serializable { public static <T extends BaseEntity> List<T> mapToBeans(final List<Map<String, Object>> beanMaps, final Class<T> beanType) { if (CollectionUtils.isEmpty(beanMaps)) { return Collections.emptyList(); } final List<T> beans = new ArrayList<>(beanMaps.size()); for (Map<String, Object> beanMap : beanMaps) { beans.add(mapToBean(beanMap, beanType)); } return beans; }  String[] attributeNames(); @SuppressWarnings("unchecked") T attributeValue(final String fieldName); T attributeValue(final String fieldName, final T defaultValue); void setAttributeValue(final String fieldName, final Object value); void setAttributeValue(final String fieldName, final Object value, final boolean isCase); Map<String, Object> beanToMap(); static T mapToBean(Map<String, Object> beanMap, Class<T> beanType); static List<T> mapToBeans(final List<Map<String, Object>> beanMaps, final Class<T> beanType); static Map<String, Method> paramMethods(Class<?> cls); static Map<String, Field> paramFields(Class<?> cls); Collection<Method> methods(); Collection<Field> fields(); @Override BaseEntity clone(); @Override String toString();  }