### Question:
ReflectUtils { public static <T> T map2Object (final Map<String, Object> map, final Class<T> valueType) throws IllegalAccessException, InstantiationException { final T obj = valueType.newInstance(); final String METHOD_PREFIX = "set"; map.forEach((fieldName, fieldValue) -> { final StringBuilder sb = new StringBuilder(); try { final Method method = ReflectUtils.getMethod(valueType, sb.append(METHOD_PREFIX).append(StringUtils.capitalize(fieldName)).toString()); method.invoke(obj, fieldValue); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { LOG.error(e.getMessage()); } }); return obj; } private  ReflectUtils(); static Field getField(final Class clazz, final String fieldName); static Method getMethod(final Class clazz, final String methodName); static T map2Object(final Map<String, Object> map, final Class<T> valueType);  }### Answer:
@Test public void testMap2Object () throws InstantiationException, IllegalAccessException { final Map<String, Object> map = new HashMap<>(); map.put("name", "bascker"); map.put("age", 24); map.put("sex", Sex.MALE); Assert.assertEquals("Person{mName='bascker', mAge=24, mSex=MALE}", ReflectUtils.map2Object(map, Person.class).toString()); }