public static < T > T objectify ( ObjectMapper mapper , Object source , JavaType targetType ) { try { return mapper . readValue ( mapper . writeValueAsBytes ( source ) , targetType ) ; } catch ( RuntimeException e ) { throw e ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
Converts an object to an instance of the target type .