@Override public T read( String input ) { return mapper.read( input, deserCtx ); }
@Override public String write( T input ) { return mapper.write( input, serCtx ); } };
@Override public <T> T deserialize(String type, ContentType contentType, String json) { if (VOID.equals(type) || json == null || json.isEmpty()) { return null; } ObjectMapper<T> mapper = jacksonMapperProvider.getMapper(type); try { return mapper.read(json, getDeserializationContext().build()); } catch (JsonMappingException e) { throw new SerializationException("Unable to deserialize response. An unexpected error occurred.", e); } }
@Override public <T> SerializedValue serialize(String type, List<ContentType> contentTypes, T o) { if (VOID.equals(type) || o == null) { return null; } ObjectMapper<T> mapper = jacksonMapperProvider.getMapper(type); String json; try { json = mapper.write(o, getSerializationContext().build()); } catch (JsonMappingException e) { throw new SerializationException("Unable to serialize request body. An unexpected error occurred.", e); } return new SerializedValue(CONTENT_TYPE, json); }