T - is the generic type of the Datatype to serialize.public class DatatypeJsonDeserializer<T>
extends com.fasterxml.jackson.databind.JsonDeserializer<T>
JsonDeserializer based on DatatypeDescriptorManager so
every Datatype supported by DatatypeDescriptorManager can be
deserialized from JSON.DatatypeJsonSerializer| Modifier and Type | Field and Description |
|---|---|
private Class<T> |
datatype
The class reflecting the datatype to deserialize.
|
private DatatypeDescriptorManager |
datatypeDescriptorManager |
| Constructor and Description |
|---|
DatatypeJsonDeserializer(Class<T> datatype)
The constructor.
|
DatatypeJsonDeserializer(Class<T> datatype,
DatatypeDescriptorManager datatypeDescriptorManager)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
T |
deserialize(com.fasterxml.jackson.core.JsonParser parser,
com.fasterxml.jackson.databind.DeserializationContext context) |
<V> V |
deserializeGeneric(com.fasterxml.jackson.core.JsonParser parser,
com.fasterxml.jackson.databind.DeserializationContext context,
Class<V> type,
com.fasterxml.jackson.databind.JsonNode parentNode,
DatatypeSegmentDescriptor<?,?> segment)
Generic and recursive implementation of
deserialize(JsonParser, DeserializationContext). |
protected <V> V |
getValue(com.fasterxml.jackson.databind.JsonNode valueNode,
Class<V> type)
Gets and converts the value of the given
JsonNode. |
protected <V> V |
getValue(com.fasterxml.jackson.databind.JsonNode node,
String fieldName,
Class<V> type,
boolean required)
Gets and converts the specified value from the given
JsonNode. |
void |
setDatatypeDescriptorManager(DatatypeDescriptorManager datatypeDescriptorManager) |
private DatatypeDescriptorManager datatypeDescriptorManager
public DatatypeJsonDeserializer(Class<T> datatype)
datatype - is the class reflecting the datatype to deserialize.public DatatypeJsonDeserializer(Class<T> datatype, DatatypeDescriptorManager datatypeDescriptorManager)
datatype - is the class reflecting the datatype to deserialize.datatypeDescriptorManager - is the DatatypeDescriptorManager instance to use.@Inject public void setDatatypeDescriptorManager(DatatypeDescriptorManager datatypeDescriptorManager)
datatypeDescriptorManager - is the DatatypeDescriptorManager to Inject.protected <V> V getValue(com.fasterxml.jackson.databind.JsonNode node,
String fieldName,
Class<V> type,
boolean required)
JsonNode.V - is the generic type of the requested value.node - is the JsonNode containing the value as child.fieldName - is the field name of the requested value.type - is the Class reflecting the requested type to convert to.required - - true if the value is mandatory and an exception will be thrown if the
value is not present, false otherwise.null if not set and required
is false.protected <V> V getValue(com.fasterxml.jackson.databind.JsonNode valueNode,
Class<V> type)
JsonNode.V - is the generic type of the requested value.valueNode - is the JsonNode containing the value.type - is the Class reflecting the requested type to convert to.null if not set.public <V> V deserializeGeneric(com.fasterxml.jackson.core.JsonParser parser,
com.fasterxml.jackson.databind.DeserializationContext context,
Class<V> type,
com.fasterxml.jackson.databind.JsonNode parentNode,
DatatypeSegmentDescriptor<?,?> segment)
throws IOException
deserialize(JsonParser, DeserializationContext).V - is the generic type of the expected value to deserialize.parser - is the JsonParser.context - is the DeserializationContext.type - is the Class reflecting the expected type of the value to deserialize.parentNode - is the JsonNode that has already been parsed (recursive call) or
null if the value has to be read from JsonParser.segment - is the DatatypeSegmentDescriptor with the segment to deserialize as child of
parentNode (recursive call) or null if the value has to be read from
JsonParser.IOException - if reading from JsonParser causes an I/O problem.public T deserialize(com.fasterxml.jackson.core.JsonParser parser, com.fasterxml.jackson.databind.DeserializationContext context) throws IOException, com.fasterxml.jackson.core.JsonProcessingException
deserialize in class com.fasterxml.jackson.databind.JsonDeserializer<T>IOExceptioncom.fasterxml.jackson.core.JsonProcessingExceptionCopyright © 2001–2015 mmm-Team. All rights reserved.