@Test public void testGetObjectFromMap() { Map<String, Object> objectMap = new HashMap<>(); objectMap.put("id", OBJ_ID); Map<String, Object> subObjectMap = new HashMap<>(); subObjectMap.put("id", SUB_ID); objectMap.put("subObject", subObjectMap); SampleObject sampleObject = jsonHelper.getObjectFromMap(objectMap, SampleObject.class); Assert.assertNotNull(sampleObject); Assert.assertEquals(sampleObject.getId(), OBJ_ID); Assert.assertNotNull(sampleObject.getSubObject()); Assert.assertEquals(sampleObject.getSubObject().getId(), SUB_ID); }
public <T> T getObjectFromMap(Map<String, Object> map, Class<T> clazz) { return objectMapper.convertValue(map, clazz); }
JsonHelper { public <T> T getObjectFromMap(Map<String, Object> map, Class<T> clazz) { return objectMapper.convertValue(map, clazz); } }
JsonHelper { public <T> T getObjectFromMap(Map<String, Object> map, Class<T> clazz) { return objectMapper.convertValue(map, clazz); } JsonHelper(); }
JsonHelper { public <T> T getObjectFromMap(Map<String, Object> map, Class<T> clazz) { return objectMapper.convertValue(map, clazz); } JsonHelper(); T getObjectFromRef(JsonNode rootNode, String ref, Class<T> clazz); Map<String, Object> getMapFromObject(Object object); T getObjectFromMap(Map<String, Object> map, Class<T> clazz); T getObjectFromString(String json, Class<T> clazz); String getJSONString(Object object); String getPrettyJSONString(Object object); void setNodeValue(JsonNode rootNode, String jsonPtrExpr, String value); ObjectMapper getObjectMapper(); }
JsonHelper { public <T> T getObjectFromMap(Map<String, Object> map, Class<T> clazz) { return objectMapper.convertValue(map, clazz); } JsonHelper(); T getObjectFromRef(JsonNode rootNode, String ref, Class<T> clazz); Map<String, Object> getMapFromObject(Object object); T getObjectFromMap(Map<String, Object> map, Class<T> clazz); T getObjectFromString(String json, Class<T> clazz); String getJSONString(Object object); String getPrettyJSONString(Object object); void setNodeValue(JsonNode rootNode, String jsonPtrExpr, String value); ObjectMapper getObjectMapper();  }