Package org.springframework.boot.jackson
Class JsonObjectDeserializer<T>
- java.lang.Object
- com.fasterxml.jackson.databind.JsonDeserializer<T>
- org.springframework.boot.jackson.JsonObjectDeserializer<T>
- Type Parameters:
T
- the supported object type
- All Implemented Interfaces:
com.fasterxml.jackson.databind.deser.NullValueProvider
public abstract class JsonObjectDeserializer<T> extends com.fasterxml.jackson.databind.JsonDeserializer<T>
Helper base class forJsonDeserializer
implementations that deserialize objects.- Since:
- 1.4.0
- See Also:
JsonObjectSerializer
Constructor Summary
Constructors Constructor Description JsonObjectDeserializer()
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description T
deserialize(com.fasterxml.jackson.core.JsonParser jp, com.fasterxml.jackson.databind.DeserializationContext ctxt)
protected abstract T
deserializeObject(com.fasterxml.jackson.core.JsonParser jsonParser, com.fasterxml.jackson.databind.DeserializationContext context, com.fasterxml.jackson.core.ObjectCodec codec, com.fasterxml.jackson.databind.JsonNode tree)
Deserialize JSON content into the value type this serializer handles.protected com.fasterxml.jackson.databind.JsonNode
getRequiredNode(com.fasterxml.jackson.databind.JsonNode tree, String fieldName)
Helper method to return aJsonNode
from the tree.protected <D> D
nullSafeValue(com.fasterxml.jackson.databind.JsonNode jsonNode, Class<D> type)
Helper method to extract a value from the givenjsonNode
or returnnull
when the node itself isnull
.Methods inherited from class com.fasterxml.jackson.databind.JsonDeserializer
deserialize, deserializeWithType, findBackReference, getDelegatee, getEmptyAccessPattern, getEmptyValue, getEmptyValue, getKnownPropertyNames, getNullAccessPattern, getNullValue, getNullValue, getObjectIdReader, handledType, isCachable, replaceDelegatee, supportsUpdate, unwrappingDeserializer
Constructor Detail
JsonObjectDeserializer
public JsonObjectDeserializer()
Method Detail
deserialize
public final T deserialize(com.fasterxml.jackson.core.JsonParser jp, com.fasterxml.jackson.databind.DeserializationContext ctxt) throws IOException
- Specified by:
deserialize
in classcom.fasterxml.jackson.databind.JsonDeserializer<T>
- Throws:
IOException
deserializeObject
protected abstract T deserializeObject(com.fasterxml.jackson.core.JsonParser jsonParser, com.fasterxml.jackson.databind.DeserializationContext context, com.fasterxml.jackson.core.ObjectCodec codec, com.fasterxml.jackson.databind.JsonNode tree) throws IOException
Deserialize JSON content into the value type this serializer handles.- Parameters:
jsonParser
- the source parser used for reading JSON contentcontext
- context that can be used to access information about this deserialization activitycodec
- theObjectCodec
associated with the parsertree
- deserialized JSON content as tree expressed using set ofTreeNode
instances- Returns:
- the deserialized object
- Throws:
IOException
- on error- See Also:
deserialize(JsonParser, DeserializationContext)
nullSafeValue
protected final <D> D nullSafeValue(com.fasterxml.jackson.databind.JsonNode jsonNode, Class<D> type)
Helper method to extract a value from the givenjsonNode
or returnnull
when the node itself isnull
.- Type Parameters:
D
- the data type requested- Parameters:
jsonNode
- the source node (may benull
)type
- the data type. May beString
,Boolean
,Long
,Integer
,Short
,Double
,Float
,BigDecimal
orBigInteger
.- Returns:
- the node value or
null
getRequiredNode
protected final com.fasterxml.jackson.databind.JsonNode getRequiredNode(com.fasterxml.jackson.databind.JsonNode tree, String fieldName)
Helper method to return aJsonNode
from the tree.- Parameters:
tree
- the source treefieldName
- the field name to extract- Returns:
- the
JsonNode