Class JsonNodeDeserializer

All Implemented Interfaces:
NullValueProvider, ValueInstantiator.Gettable

public class JsonNodeDeserializer extends BaseNodeDeserializer<JsonNode>
Deserializer that can build instances of JsonNode from any JSON content, using appropriate JsonNode type.
  • Constructor Details

    • JsonNodeDeserializer

      protected JsonNodeDeserializer()
    • JsonNodeDeserializer

      protected JsonNodeDeserializer(JsonNodeDeserializer base, boolean mergeArrays, boolean mergeObjects)
  • Method Details

    • _createWithMerge

      protected BaseNodeDeserializer<?> _createWithMerge(boolean mergeArrays, boolean mergeObjects)
      Specified by:
      _createWithMerge in class BaseNodeDeserializer<JsonNode>
    • getDeserializer

      public static BaseNodeDeserializer<?> getDeserializer(Class<?> nodeClass)
      Factory method for accessing deserializer for specific node type
    • getNullValue

      public JsonNode getNullValue(DeserializationContext ctxt)
      Description copied from class: ValueDeserializer
      Method that can be called to determine value to be used for representing null values (values deserialized when JSON token is JsonToken.VALUE_NULL). Usually this is simply Java null, but for some types (especially primitives) it may be necessary to use non-null values.

      This method may be called once, or multiple times, depending on what ValueDeserializer.getNullAccessPattern() returns.

      Default implementation simply returns null.

      Specified by:
      getNullValue in interface NullValueProvider
      Overrides:
      getNullValue in class ValueDeserializer<JsonNode>
    • getAbsentValue

      public Object getAbsentValue(DeserializationContext ctxt)
      Overridden variant to ensure that absent values are NOT coerced into NullNodes, unlike incoming null values.
      Specified by:
      getAbsentValue in interface NullValueProvider
      Overrides:
      getAbsentValue in class ValueDeserializer<JsonNode>
    • deserialize

      public JsonNode deserialize(tools.jackson.core.JsonParser p, DeserializationContext ctxt) throws tools.jackson.core.JacksonException
      Implementation that will produce types of any JSON nodes; not just one deserializer is registered to handle (in case of more specialized handler). Overridden by typed sub-classes for more thorough checking
      Specified by:
      deserialize in class ValueDeserializer<JsonNode>
      Parameters:
      p - Parser used for reading JSON content
      ctxt - Context that can be used to access information about this deserialization activity.
      Returns:
      Deserialized value
      Throws:
      tools.jackson.core.JacksonException
    • supportsUpdate

      public Boolean supportsUpdate(DeserializationConfig config)
      Description copied from class: ValueDeserializer
      Introspection method that may be called to see whether deserializer supports update of an existing value (aka "merging") or not. Return value should either be Boolean.FALSE if update is not supported at all (immutable values); Boolean.TRUE if update should usually work (regular POJOs, for example), or null if this is either not known, or may sometimes work.

      Information gathered is typically used to either prevent merging update for property (either by skipping, if based on global defaults; or by exception during deserializer construction if explicit attempt made) if Boolean.FALSE returned, or inclusion if Boolean.TRUE is specified. If "unknown" case (null returned) behavior is to exclude property if global defaults used; or to allow if explicit per-type or property merging is defined.

      Default implementation returns null to allow explicit per-type or per-property attempts.

      Overrides:
      supportsUpdate in class BaseNodeDeserializer<JsonNode>