@Test public void testGetObject() throws Exception { ObjectMapper objectMapper = new ObjectMapper(); final String ROOT_ID = "rootId"; final String SUB_ID = "subId"; final SampleObject sample = new SampleObject(); sample.setId(ROOT_ID); final SampleObject subSample = new SampleObject(); subSample.setId(SUB_ID); sample.setSubObject(subSample); JsonContainer jsonContainer = new JsonContainer(objectMapper.writeValueAsString(sample)); SampleObject result = jsonContainer.getObject(SampleObject.class); Assert.assertNotNull(result); Assert.assertEquals(result.getId(), sample.getId()); Assert.assertEquals(result.getSubObject().getId(), sample.getSubObject().getId()); }
public <T> T getObject(Class<T> clazz) { return jsonHelper.getObjectFromRef(rootNode, "", clazz); }
JsonContainer { public <T> T getObject(Class<T> clazz) { return jsonHelper.getObjectFromRef(rootNode, "", clazz); } }
JsonContainer { public <T> T getObject(Class<T> clazz) { return jsonHelper.getObjectFromRef(rootNode, "", clazz); } JsonContainer(String jsonString); }
JsonContainer { public <T> T getObject(Class<T> clazz) { return jsonHelper.getObjectFromRef(rootNode, "", clazz); } JsonContainer(String jsonString); T getObjectFromRef(String ref, Class<T> clazz); T getObject(Class<T> clazz); void setJsonHelper(JsonHelper jsonHelper); JsonNode getRootNode(); }
JsonContainer { public <T> T getObject(Class<T> clazz) { return jsonHelper.getObjectFromRef(rootNode, "", clazz); } JsonContainer(String jsonString); T getObjectFromRef(String ref, Class<T> clazz); T getObject(Class<T> clazz); void setJsonHelper(JsonHelper jsonHelper); JsonNode getRootNode();  }