Class ObjectValueDeserializer<T>
java.lang.Object
tools.jackson.databind.ValueDeserializer<T>
org.springframework.boot.jackson.ObjectValueDeserializer<T>
- Type Parameters:
T
- the supported object type
- All Implemented Interfaces:
tools.jackson.databind.deser.NullValueProvider
public abstract class ObjectValueDeserializer<T>
extends tools.jackson.databind.ValueDeserializer<T>
Helper base class for
ValueDeserializer
implementations that deserialize
objects.- Since:
- 4.0.0
- Author:
- Phillip Webb
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class tools.jackson.databind.ValueDeserializer
tools.jackson.databind.ValueDeserializer.None
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal T
deserialize
(tools.jackson.core.JsonParser jp, tools.jackson.databind.DeserializationContext ctxt) protected abstract T
deserializeObject
(tools.jackson.core.JsonParser jsonParser, tools.jackson.databind.DeserializationContext context, tools.jackson.databind.JsonNode tree) Deserialize JSON content into the value type this serializer handles.protected final tools.jackson.databind.JsonNode
getRequiredNode
(tools.jackson.databind.JsonNode tree, String fieldName) Helper method to return aJsonNode
from the tree.protected final <D> @Nullable D
nullSafeValue
(@Nullable tools.jackson.databind.JsonNode jsonNode, Class<D> type) Helper method to extract a value from the givenjsonNode
or returnnull
when the node itself isnull
.protected final <D,
R> @Nullable R nullSafeValue
(@Nullable tools.jackson.databind.JsonNode jsonNode, Class<D> type, Function<D, R> mapper) Helper method to extract a value from the givenjsonNode
or returnnull
when the node itself isnull
.Methods inherited from class tools.jackson.databind.ValueDeserializer
createContextual, deserialize, deserializeWithType, deserializeWithType, findBackReference, getAbsentValue, getDelegatee, getEmptyAccessPattern, getEmptyValue, getKnownPropertyNames, getNullAccessPattern, getNullValue, getObjectIdReader, handledType, isCachable, logicalType, replaceDelegatee, resolve, supportsUpdate, unwrappingDeserializer
-
Constructor Details
-
ObjectValueDeserializer
public ObjectValueDeserializer()
-
-
Method Details
-
deserialize
-
deserializeObject
protected abstract T deserializeObject(tools.jackson.core.JsonParser jsonParser, tools.jackson.databind.DeserializationContext context, tools.jackson.databind.JsonNode tree) 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 activitytree
- deserialized JSON content as tree expressed using set ofTreeNode
instances- Returns:
- the deserialized object
- See Also:
-
nullSafeValue
protected final <D,R> @Nullable R nullSafeValue(@Nullable tools.jackson.databind.JsonNode jsonNode, Class<D> type, Function<D, R> mapper) Helper method to extract a value from the givenjsonNode
or returnnull
when the node itself isnull
.- Type Parameters:
D
- the data type requestedR
- the result type- Parameters:
jsonNode
- the source node (may benull
)type
- the data type. May beString
,Boolean
,Long
,Integer
,Short
,Double
,Float
,BigDecimal
orBigInteger
.mapper
- a mapper to convert the value when it is notnull
- Returns:
- the node value or
null
- Since:
- 3.4.0
-
nullSafeValue
protected final <D> @Nullable D nullSafeValue(@Nullable tools.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 tools.jackson.databind.JsonNode getRequiredNode(tools.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
-