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 Tdeserialize(tools.jackson.core.JsonParser jp, tools.jackson.databind.DeserializationContext ctxt) protected abstract TdeserializeObject(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.JsonNodegetRequiredNode(tools.jackson.databind.JsonNode tree, String fieldName) Helper method to return aJsonNodefrom the tree.protected final <D> @Nullable DnullSafeValue(@Nullable tools.jackson.databind.JsonNode jsonNode, Class<D> type) Helper method to extract a value from the givenjsonNodeor returnnullwhen 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 givenjsonNodeor returnnullwhen 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 ofTreeNodeinstances- 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 givenjsonNodeor returnnullwhen 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,BigDecimalorBigInteger.mapper- a mapper to convert the value when it is notnull- Returns:
- the node value or
null
-
nullSafeValue
protected final <D> @Nullable D nullSafeValue(@Nullable tools.jackson.databind.JsonNode jsonNode, Class<D> type) Helper method to extract a value from the givenjsonNodeor returnnullwhen 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,BigDecimalorBigInteger.- 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 aJsonNodefrom the tree.- Parameters:
tree- the source treefieldName- the field name to extract- Returns:
- the
JsonNode
-