Created
July 8, 2014 18:07
-
-
Save mressler/a2c082f75deb04ac367f to your computer and use it in GitHub Desktop.
Type Erasure and Deserializing JSON Objects
This file contains 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
public static class ProfileResponse extends ODataListValueDTO<UserProfileDTO> {} | |
// I was having a lot of difficulty getting Jackson to appropriately deserialize a complex | |
// data type due to type erasure. By creating an "as needed" class, I can avoid the type | |
// erasure problem and get an ODataListValueDTO<UserProfileDTO> as a result | |
ResponseEntity<ProfileResponse> profileResponse = template.exchange( | |
"http://localhost:8080/dummy", | |
HttpMethod.POST, | |
new HttpEntity<UserProfileDTO>(toSend, headers), | |
ProfileResponse.class); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment