ObjectMapper in Java 8
public static <T> List<T> mapPayloadListToPOJOList(List<String> payloadList, Class<T> pojo) throws IOException {
ObjectMapper mapper = new ObjectMapper();
List<T> pojoList = new ArrayList<>();
for (String payload : payloadList) {
T mapped = mapper.readValue(payload, pojo);
pojoList.add(mapped);
}
return pojoList;
}
Mohammed NAIMI