Guest User

Untitled

a guest
Oct 25th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. public static <T> T convert(Object o, Class<T> clazz) {
  2. ObjectMapper mapper = new ObjectMapper();
  3. try {
  4. return mapper.convertValue(o, clazz);
  5. } catch (IllegalArgumentException e) {
  6. // just can't be converted
  7. return null;
  8. }
  9. }
Add Comment
Please, Sign In to add comment