Class JsonNodeDeserializer
- java.lang.Object
-
- com.fasterxml.jackson.databind.JsonDeserializer<T>
-
- com.fasterxml.jackson.databind.deser.std.StdDeserializer<T>
-
- com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer<JsonNode>
-
- com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer
-
- All Implemented Interfaces:
ContextualDeserializer,NullValueProvider,ValueInstantiator.Gettable,java.io.Serializable
public class JsonNodeDeserializer extends BaseNodeDeserializer<JsonNode>
Deserializer that can build instances ofJsonNodefrom any JSON content, using appropriateJsonNodetype.Rewritten in Jackson 2.13 to avoid recursion and allow handling of very deeply nested structures.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classJsonNodeDeserializer.ArrayDeserializerImplementation used when declared type is specificallyArrayNode.(package private) static classJsonNodeDeserializer.ObjectDeserializerImplementation used when declared type is specificallyObjectNode.-
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer
BaseNodeDeserializer.ContainerStack
-
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonDeserializer
JsonDeserializer.None
-
-
Field Summary
Fields Modifier and Type Field Description private static JsonNodeDeserializerinstanceSingleton instance of generic deserializer forJsonNode.-
Fields inherited from class com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer
_mergeArrays, _mergeObjects, _supportsUpdates
-
Fields inherited from class com.fasterxml.jackson.databind.deser.std.StdDeserializer
_valueClass, _valueType, F_MASK_ACCEPT_ARRAYS, F_MASK_INT_COERCIONS
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedJsonNodeDeserializer()protectedJsonNodeDeserializer(JsonNodeDeserializer base, boolean mergeArrays, boolean mergeObjects)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected JsonDeserializer<?>_createWithMerge(boolean mergeArrays, boolean mergeObjects)JsonNodedeserialize(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).java.lang.ObjectgetAbsentValue(DeserializationContext ctxt)Overridden variant to ensure that absent values are NOT coerced intoNullNodes, unlike incomingnullvalues.static JsonDeserializer<? extends JsonNode>getDeserializer(java.lang.Class<?> nodeClass)Factory method for accessing deserializer for specific node typeJsonNodegetNullValue(DeserializationContext ctxt)Method that can be called to determine value to be used for representing null values (values deserialized when JSON token isJsonToken.VALUE_NULL).java.lang.BooleansupportsUpdate(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, updateObject
-
Methods 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, _parseInteger, _parseIntPrimitive, _parseIntPrimitive, _parseIntPrimitive, _parseLong, _parseLong, _parseLong, _parseLongPrimitive, _parseLongPrimitive, _parseLongPrimitive, _parseShortPrimitive, _parseString, _parseString, _reportFailedNullCoerce, _shortOverflow, _streamReadConstraints, _verifyEndArrayForSingle, _verifyNullForPrimitive, _verifyNullForPrimitiveCoercion, _verifyNullForScalarCoercion, _verifyNumberForScalarCoercion, _verifyStringForScalarCoercion, findContentNullProvider, findContentNullStyle, findConvertingContentDeserializer, findDeserializer, findFormatFeature, findFormatOverrides, findValueNullProvider, getValueClass, getValueInstantiator, getValueType, getValueType, handledType, handleMissingEndArrayForSingle, handleNestedArrayForSingle, handleUnknownProperty, isDefaultDeserializer, isDefaultKeyDeserializer
-
Methods inherited from class com.fasterxml.jackson.databind.JsonDeserializer
deserialize, deserializeWithType, findBackReference, getDelegatee, getEmptyAccessPattern, getEmptyValue, getEmptyValue, getKnownPropertyNames, getNullAccessPattern, getNullValue, getObjectIdReader, replaceDelegatee, unwrappingDeserializer
-
-
-
-
Field Detail
-
instance
private static final JsonNodeDeserializer instance
Singleton instance of generic deserializer forJsonNode. Only used for types other than JSON Object and Array.
-
-
Constructor Detail
-
JsonNodeDeserializer
protected JsonNodeDeserializer()
-
JsonNodeDeserializer
protected JsonNodeDeserializer(JsonNodeDeserializer base, boolean mergeArrays, boolean mergeObjects)
-
-
Method Detail
-
_createWithMerge
protected JsonDeserializer<?> _createWithMerge(boolean mergeArrays, boolean mergeObjects)
- Specified by:
_createWithMergein classBaseNodeDeserializer<JsonNode>
-
getDeserializer
public static JsonDeserializer<? extends JsonNode> getDeserializer(java.lang.Class<?> nodeClass)
Factory method for accessing deserializer for specific node type
-
getNullValue
public JsonNode getNullValue(DeserializationContext ctxt)
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
public java.lang.Object getAbsentValue(DeserializationContext ctxt)
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 java.io.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:
java.io.IOException
-
supportsUpdate
public java.lang.Boolean supportsUpdate(DeserializationConfig config)
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>
-
-