Class JsonNodeDeserializer
- All Implemented Interfaces:
ContextualDeserializer,NullValueProvider,ValueInstantiator.Gettable,Serializable
JsonNode from any
JSON content, using appropriate JsonNode type.
Rewritten in Jackson 2.13 to avoid recursion and allow handling of very deeply nested structures.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final classImplementation used when declared type is specificallyArrayNode.(package private) static final classImplementation used when declared type is specificallyObjectNode.Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer
BaseNodeDeserializer.ContainerStackNested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonDeserializer
JsonDeserializer.None -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final JsonNodeDeserializerSingleton instance of generic deserializer forJsonNode.Fields inherited from class com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer
_mergeArrays, _mergeObjects, _supportsUpdatesFields inherited from class com.fasterxml.jackson.databind.deser.std.StdDeserializer
_valueClass, _valueType, F_MASK_ACCEPT_ARRAYS, F_MASK_INT_COERCIONS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedJsonNodeDeserializer(JsonNodeDeserializer base, boolean mergeArrays, boolean mergeObjects) -
Method Summary
Modifier and TypeMethodDescriptionprotected JsonDeserializer<?> _createWithMerge(boolean mergeArrays, boolean mergeObjects) deserialize(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt) Implementation that will produce types of any JSON nodes; not just one deserializer is registered to handle (in case of more specialized handler).Overridden variant to ensure that absent values are NOT coerced intoNullNodes, unlike incomingnullvalues.static JsonDeserializer<? extends JsonNode> getDeserializer(Class<?> nodeClass) Factory method for accessing deserializer for specific node typeMethod that can be called to determine value to be used for representing null values (values deserialized when JSON token isJsonToken.VALUE_NULL).supportsUpdate(DeserializationConfig config) Introspection method that may be called to see whether deserializer supports update of an existing value (aka "merging") or not.Methods inherited from class com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer
_deserializeAnyScalar, _deserializeContainerNoRecursion, _deserializeObjectAtName, _deserializeRareScalar, _fromBigDecimal, _fromEmbedded, _fromFloat, _fromInt, _fromInt, _handleDuplicateField, createContextual, deserializeWithType, isCachable, logicalType, updateObjectMethods inherited from class com.fasterxml.jackson.databind.deser.std.StdDeserializer
_byteOverflow, _checkBooleanToStringCoercion, _checkCoercionFail, _checkDoubleSpecialValue, _checkFloatSpecialValue, _checkFloatToIntCoercion, _checkFloatToStringCoercion, _checkFromStringCoercion, _checkFromStringCoercion, _checkIntToFloatCoercion, _checkIntToStringCoercion, _checkTextualNull, _checkToStringCoercion, _coerceBooleanFromInt, _coercedTypeDesc, _coercedTypeDesc, _coerceEmptyString, _coerceIntegral, _coerceNullToken, _coerceTextualNull, _deserializeFromArray, _deserializeFromEmpty, _deserializeFromEmptyString, _deserializeFromString, _deserializeWrappedValue, _failDoubleToIntCoercion, _findCoercionFromBlankString, _findCoercionFromEmptyArray, _findCoercionFromEmptyString, _findNullProvider, _hasTextualNull, _intOverflow, _isBlank, _isEmptyOrTextualNull, _isFalse, _isIntNumber, _isNaN, _isNegInf, _isPosInf, _isTrue, _neitherNull, _nonNullNumber, _parseBoolean, _parseBooleanFromInt, _parseBooleanPrimitive, _parseBooleanPrimitive, _parseBytePrimitive, _parseDate, _parseDate, _parseDateFromArray, _parseDouble, _parseDouble, _parseDoublePrimitive, _parseDoublePrimitive, _parseDoublePrimitive, _parseFloatPrimitive, _parseFloatPrimitive, _parseFloatPrimitive, _parseInteger, _parseInteger, _parseIntPrimitive, _parseIntPrimitive, _parseLong, _parseLong, _parseLongPrimitive, _parseLongPrimitive, _parseShortPrimitive, _parseString, _parseString, _reportFailedNullCoerce, _shortOverflow, _verifyEndArrayForSingle, _verifyNullForPrimitive, _verifyNullForPrimitiveCoercion, _verifyNullForScalarCoercion, _verifyNumberForScalarCoercion, _verifyStringForScalarCoercion, findContentNullProvider, findContentNullStyle, findConvertingContentDeserializer, findDeserializer, findFormatFeature, findFormatOverrides, findValueNullProvider, getValueClass, getValueInstantiator, getValueType, getValueType, handledType, handleMissingEndArrayForSingle, handleNestedArrayForSingle, handleUnknownProperty, isDefaultDeserializer, isDefaultKeyDeserializerMethods inherited from class com.fasterxml.jackson.databind.JsonDeserializer
deserialize, deserializeWithType, findBackReference, getDelegatee, getEmptyAccessPattern, getEmptyValue, getEmptyValue, getKnownPropertyNames, getNullAccessPattern, getNullValue, getObjectIdReader, replaceDelegatee, unwrappingDeserializer
-
Field Details
-
instance
Singleton instance of generic deserializer forJsonNode. Only used for types other than JSON Object and Array.
-
-
Constructor Details
-
JsonNodeDeserializer
protected JsonNodeDeserializer() -
JsonNodeDeserializer
protected JsonNodeDeserializer(JsonNodeDeserializer base, boolean mergeArrays, boolean mergeObjects)
-
-
Method Details
-
_createWithMerge
- Specified by:
_createWithMergein classBaseNodeDeserializer<JsonNode>
-
getDeserializer
Factory method for accessing deserializer for specific node type -
getNullValue
Description copied from class:JsonDeserializerMethod that can be called to determine value to be used for representing null values (values deserialized when JSON token isJsonToken.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
JsonDeserializer.getNullAccessPattern()returns.Default implementation simply returns null.
- Specified by:
getNullValuein interfaceNullValueProvider- Overrides:
getNullValuein classJsonDeserializer<JsonNode>
-
getAbsentValue
Overridden variant to ensure that absent values are NOT coerced intoNullNodes, unlike incomingnullvalues.- Specified by:
getAbsentValuein interfaceNullValueProvider- Overrides:
getAbsentValuein classJsonDeserializer<JsonNode>
-
deserialize
public JsonNode deserialize(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt) throws IOException 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:
deserializein classJsonDeserializer<JsonNode>- Parameters:
p- Parser used for reading JSON contentctxt- Context that can be used to access information about this deserialization activity.- Returns:
- Deserialized value
- Throws:
IOException
-
supportsUpdate
Description copied from class:JsonDeserializerIntrospection method that may be called to see whether deserializer supports update of an existing value (aka "merging") or not. Return value should either beBoolean.FALSEif update is not supported at all (immutable values);Boolean.TRUEif update should usually work (regular POJOs, for example), ornullif 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.FALSEreturned, or inclusion ifBoolean.TRUEis specified. If "unknown" case (nullreturned) behavior is to exclude property if global defaults used; or to allow if explicit per-type or property merging is defined.Default implementation returns
nullto allow explicit per-type or per-property attempts.- Overrides:
supportsUpdatein classBaseNodeDeserializer<JsonNode>
-