Module tools.jackson.databind
Class TypeDeserializerBase
java.lang.Object
tools.jackson.databind.jsontype.TypeDeserializer
tools.jackson.databind.jsontype.impl.TypeDeserializerBase
- Direct Known Subclasses:
AsArrayTypeDeserializer,AsWrapperTypeDeserializer
Base class for all standard Jackson
TypeDeserializers.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final JavaTypeprotected final JavaTypeType to use as the default implementation, if type id is missing or cannot be resolved.protected ValueDeserializer<Object>protected final Map<String,ValueDeserializer<Object>> For efficient operation we will lazily build mappings from type ids to actual deserializers, once needed.protected final TypeIdResolverprotected final BeanPropertyProperty that contains value for which type information is included; null if value is a root value.protected final booleanprotected final StringName of type property used; needed for non-property versions too, in cases where type id is to be exposed as part of JSON. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTypeDeserializerBase(JavaType baseType, TypeIdResolver idRes, String typePropertyName, boolean typeIdVisible, JavaType defaultImpl) protectedTypeDeserializerBase(TypeDeserializerBase src, BeanProperty property) -
Method Summary
Modifier and TypeMethodDescriptionprotected Object_deserializeWithNativeTypeId(JsonParser p, DeserializationContext ctxt, Object typeId) Helper method called whenJsonParserindicates that it can use so-called native type ids, and such type id has been found.protected final ValueDeserializer<Object>protected final ValueDeserializer<Object>_findDeserializer(DeserializationContext ctxt, String typeId) protected JavaType_handleMissingTypeId(DeserializationContext ctxt, String extraDesc) protected JavaType_handleUnknownTypeId(DeserializationContext ctxt, String typeId) Helper method called when given type id cannot be resolved into concrete deserializer either directly (using givenTypeIdResolver), or using default type.baseType()abstract TypeDeserializerforProperty(BeanProperty prop) Method called to create contextual version, to be used for values of given property.Class<?>Accessor for "default implementation" type; optionally defined class to use in cases where type id is not accessible for some reason (either missing, or cannot be resolved)final StringName of property that contains type information, if property-based inclusion is used.Accessor for object that handles conversions between types and matching type ids.abstract JsonTypeInfo.AsAccessor for type information inclusion method that deserializer uses; indicates how type information is (expected to be) embedded in JSON input.booleantoString()Methods inherited from class tools.jackson.databind.jsontype.TypeDeserializer
deserializeIfNatural, deserializeIfNatural, deserializeTypedFromAny, deserializeTypedFromArray, deserializeTypedFromObject, deserializeTypedFromScalar
-
Field Details
-
_idResolver
-
_baseType
-
_property
Property that contains value for which type information is included; null if value is a root value. Note that this value is not assigned during construction but only whenforProperty(tools.jackson.databind.BeanProperty)is called to create a copy. -
_defaultImpl
Type to use as the default implementation, if type id is missing or cannot be resolved. -
_typePropertyName
Name of type property used; needed for non-property versions too, in cases where type id is to be exposed as part of JSON. -
_typeIdVisible
protected final boolean _typeIdVisible -
_deserializers
For efficient operation we will lazily build mappings from type ids to actual deserializers, once needed. -
_defaultImplDeserializer
-
-
Constructor Details
-
TypeDeserializerBase
protected TypeDeserializerBase(JavaType baseType, TypeIdResolver idRes, String typePropertyName, boolean typeIdVisible, JavaType defaultImpl) - Since:
- 2.8
-
TypeDeserializerBase
-
-
Method Details
-
forProperty
Description copied from class:TypeDeserializerMethod called to create contextual version, to be used for values of given property. This may be the type itself (as is the case for bean properties), or values contained (forCollectionorMapvalued properties).- Specified by:
forPropertyin classTypeDeserializer
-
getTypeInclusion
Description copied from class:TypeDeserializerAccessor for type information inclusion method that deserializer uses; indicates how type information is (expected to be) embedded in JSON input.- Specified by:
getTypeInclusionin classTypeDeserializer
-
baseTypeName
-
getPropertyName
Description copied from class:TypeDeserializerName of property that contains type information, if property-based inclusion is used.- Specified by:
getPropertyNamein classTypeDeserializer
-
getTypeIdResolver
Description copied from class:TypeDeserializerAccessor for object that handles conversions between types and matching type ids.- Specified by:
getTypeIdResolverin classTypeDeserializer
-
getDefaultImpl
Description copied from class:TypeDeserializerAccessor for "default implementation" type; optionally defined class to use in cases where type id is not accessible for some reason (either missing, or cannot be resolved)- Specified by:
getDefaultImplin classTypeDeserializer
-
hasDefaultImpl
public boolean hasDefaultImpl()- Overrides:
hasDefaultImplin classTypeDeserializer
-
baseType
- Since:
- 2.9
-
toString
-
_findDeserializer
protected final ValueDeserializer<Object> _findDeserializer(DeserializationContext ctxt, String typeId) -
_findDefaultImplDeserializer
-
_deserializeWithNativeTypeId
protected Object _deserializeWithNativeTypeId(JsonParser p, DeserializationContext ctxt, Object typeId) throws JacksonException Helper method called whenJsonParserindicates that it can use so-called native type ids, and such type id has been found.- Throws:
JacksonException
-
_handleUnknownTypeId
protected JavaType _handleUnknownTypeId(DeserializationContext ctxt, String typeId) throws JacksonException Helper method called when given type id cannot be resolved into concrete deserializer either directly (using givenTypeIdResolver), or using default type. Default implementation simply throws aDatabindExceptionto indicate the problem; sub-classes may choose- Returns:
- If it is possible to resolve type id into a
ValueDeserializershould return that deserializer; otherwise throw an exception to indicate the problem. - Throws:
JacksonException
-
_handleMissingTypeId
protected JavaType _handleMissingTypeId(DeserializationContext ctxt, String extraDesc) throws JacksonException - Throws:
JacksonException
-