@ SuppressWarnings ( "unchecked" ) public static final < T > T parseToObject ( final String json , final TypeReference < T > type ) { if ( json == null || json . isEmpty ( ) ) throw new IllegalArgumentException ( "Incoming data was null or empty" ) ; if ( type == null ) throw new IllegalArgumentException ( "Missing type reference" ) ; try { return ( T ) jsonMapper . readValue ( json , type ) ; } catch ( JsonParseException e ) { throw new IllegalArgumentException ( e ) ; } catch ( JsonMappingException e ) { throw new IllegalArgumentException ( e ) ; } catch ( IOException e ) { throw new JSONException ( e ) ; } }
Deserializes a JSON formatted string to a specific class type