Created
December 5, 2016 19:21
-
-
Save sunieldalal/a9c821a70db1cb51baaaeaee23acd281 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Serialize the response into the DTO POJO. | |
| * Assumption: Jackson Jar is in classpath | |
| * @param strResponse | |
| * @return | |
| */ | |
| protected EmployeeDto convertResponseJsonToPojo(String strResponse) { | |
| ObjectMapper mapper = new ObjectMapper(); | |
| // Don't fail on unknown properties | |
| mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); | |
| EmployeeDto responseDto = null; | |
| try { | |
| responseDto = mapper.readValue(strResponse, EmployeeDto.class); | |
| } catch (Exception e) { | |
| throw new RuntimeException("Cannot parse response from string: " + strResponse); | |
| } | |
| return responseDto; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment