public class JsonResponseDeserializerImpl extends java.lang.Object implements ResponseDeserializer
Modifier and Type | Field and Description |
---|---|
private static com.fasterxml.jackson.databind.ObjectMapper |
mapper |
private BeanValidator |
validator |
Constructor and Description |
---|
JsonResponseDeserializerImpl(BeanValidator validator) |
Modifier and Type | Method and Description |
---|---|
<T> T |
deserialize(javax.ws.rs.core.Response response,
java.lang.Class<T> clazz)
Deserializes the passed response to an object of the specified type and
afterwards performs a validation of the object.
|
<T> T |
deserialize(javax.ws.rs.core.Response response,
com.fasterxml.jackson.core.type.TypeReference<T> entityType)
Deserializes the passed response to an object of the specified generic
type and afterwards performs a validation of the object.
|
private static final com.fasterxml.jackson.databind.ObjectMapper mapper
private BeanValidator validator
@Inject public JsonResponseDeserializerImpl(BeanValidator validator)
public <T> T deserialize(javax.ws.rs.core.Response response, java.lang.Class<T> clazz) throws DeserializationException, javax.validation.ValidationException
ResponseDeserializer
deserialize
in interface ResponseDeserializer
response
- The response to deserialize.clazz
- The type to deserialize the response to.DeserializationException
- in case the deserialization failed.javax.validation.ValidationException
- in case the validation of the deserialized object failed.public <T> T deserialize(javax.ws.rs.core.Response response, com.fasterxml.jackson.core.type.TypeReference<T> entityType) throws DeserializationException, javax.validation.ValidationException
ResponseDeserializer
deserialize
in interface ResponseDeserializer
response
- The response to deserialize.entityType
- The generic type to deserialize the response to.DeserializationException
- in case the deserialization failed.javax.validation.ValidationException
- in case the validation of the deserialized object failed.