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:
NullValueProvider

public abstract class ObjectValueDeserializer<T> extends ValueDeserializer<T>
Helper base class for ValueDeserializer implementations that deserialize objects.
Since:
4.0.0
Author:
Phillip Webb
See Also:
  • Constructor Details

    • ObjectValueDeserializer

      public ObjectValueDeserializer()
  • Method Details

    • deserialize

      public final T deserialize(JsonParser jp, DeserializationContext ctxt)
      Specified by:
      deserialize in class ValueDeserializer<T>
    • deserializeObject

      protected abstract T deserializeObject(JsonParser jsonParser, DeserializationContext context, JsonNode tree)
      Deserialize JSON content into the value type this serializer handles.
      Parameters:
      jsonParser - the source parser used for reading JSON content
      context - context that can be used to access information about this deserialization activity
      tree - deserialized JSON content as tree expressed using set of TreeNode instances
      Returns:
      the deserialized object
      See Also:
    • nullSafeValue

      protected final <D,R> @Nullable R nullSafeValue(@Nullable JsonNode jsonNode, Class<D> type, Function<D,R> mapper)
      Helper method to extract a value from the given jsonNode or return null when the node itself is null.
      Type Parameters:
      D - the data type requested
      R - the result type
      Parameters:
      jsonNode - the source node (may be null)
      type - the data type. May be String, Boolean, Long, Integer, Short, Double, Float, BigDecimal or BigInteger.
      mapper - a mapper to convert the value when it is not null
      Returns:
      the node value or null
    • nullSafeValue

      protected final <D> @Nullable D nullSafeValue(@Nullable JsonNode jsonNode, Class<D> type)
      Helper method to extract a value from the given jsonNode or return null when the node itself is null.
      Type Parameters:
      D - the data type requested
      Parameters:
      jsonNode - the source node (may be null)
      type - the data type. May be String, Boolean, Long, Integer, Short, Double, Float, BigDecimal or BigInteger.
      Returns:
      the node value or null
    • getRequiredNode

      protected final JsonNode getRequiredNode(JsonNode tree, String fieldName)
      Helper method to return a JsonNode from the tree.
      Parameters:
      tree - the source tree
      fieldName - the field name to extract
      Returns:
      the JsonNode