Class TypeDeserializerBase
- java.lang.Object
-
- com.fasterxml.jackson.databind.jsontype.TypeDeserializer
-
- com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AsArrayTypeDeserializer,AsWrapperTypeDeserializer
public abstract class TypeDeserializerBase extends TypeDeserializer implements Serializable
Base class for all standard JacksonTypeDeserializers.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected JavaType_baseTypeprotected JavaType_defaultImplType to use as the default implementation, if type id is missing or cannot be resolved.protected JsonDeserializer<Object>_defaultImplDeserializerprotected Map<String,JsonDeserializer<Object>>_deserializersFor efficient operation we will lazily build mappings from type ids to actual deserializers, once needed.protected TypeIdResolver_idResolverprotected BeanProperty_propertyProperty that contains value for which type information is included; null if value is a root value.protected boolean_typeIdVisibleprotected String_typePropertyNameName 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
Constructors Modifier Constructor Description protectedTypeDeserializerBase(JavaType baseType, TypeIdResolver idRes, String typePropertyName, boolean typeIdVisible, JavaType defaultImpl)protectedTypeDeserializerBase(TypeDeserializerBase src, BeanProperty property)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected Object_deserializeWithNativeTypeId(com.fasterxml.jackson.core.JsonParser jp, DeserializationContext ctxt)Deprecated.protected Object_deserializeWithNativeTypeId(com.fasterxml.jackson.core.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 JsonDeserializer<Object>_findDefaultImplDeserializer(DeserializationContext ctxt)protected JsonDeserializer<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.JavaTypebaseType()StringbaseTypeName()abstract TypeDeserializerforProperty(BeanProperty prop)Method called to create contextual version, to be used for values of given property.Class<?>getDefaultImpl()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)StringgetPropertyName()Name of property that contains type information, if property-based inclusion is used.TypeIdResolvergetTypeIdResolver()Accessor for object that handles conversions between types and matching type ids.abstract com.fasterxml.jackson.annotation.JsonTypeInfo.AsgetTypeInclusion()Accessor for type information inclusion method that deserializer uses; indicates how type information is (expected to be) embedded in JSON input.StringtoString()-
Methods inherited from class com.fasterxml.jackson.databind.jsontype.TypeDeserializer
deserializeIfNatural, deserializeIfNatural, deserializeTypedFromAny, deserializeTypedFromArray, deserializeTypedFromObject, deserializeTypedFromScalar
-
-
-
-
Field Detail
-
_idResolver
protected final TypeIdResolver _idResolver
-
_baseType
protected final JavaType _baseType
-
_property
protected final BeanProperty _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(com.fasterxml.jackson.databind.BeanProperty)is called to create a copy.
-
_defaultImpl
protected final JavaType _defaultImpl
Type to use as the default implementation, if type id is missing or cannot be resolved.
-
_typePropertyName
protected final String _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
protected final Map<String,JsonDeserializer<Object>> _deserializers
For efficient operation we will lazily build mappings from type ids to actual deserializers, once needed.
-
_defaultImplDeserializer
protected JsonDeserializer<Object> _defaultImplDeserializer
-
-
Constructor Detail
-
TypeDeserializerBase
protected TypeDeserializerBase(JavaType baseType, TypeIdResolver idRes, String typePropertyName, boolean typeIdVisible, JavaType defaultImpl)
- Since:
- 2.8
-
TypeDeserializerBase
protected TypeDeserializerBase(TypeDeserializerBase src, BeanProperty property)
-
-
Method Detail
-
forProperty
public abstract TypeDeserializer forProperty(BeanProperty prop)
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
public abstract com.fasterxml.jackson.annotation.JsonTypeInfo.As 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
public String baseTypeName()
-
getPropertyName
public final String getPropertyName()
Description copied from class:TypeDeserializerName of property that contains type information, if property-based inclusion is used.- Specified by:
getPropertyNamein classTypeDeserializer
-
getTypeIdResolver
public TypeIdResolver getTypeIdResolver()
Description copied from class:TypeDeserializerAccessor for object that handles conversions between types and matching type ids.- Specified by:
getTypeIdResolverin classTypeDeserializer
-
getDefaultImpl
public Class<?> 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
-
baseType
public JavaType baseType()
- Since:
- 2.9
-
_findDeserializer
protected final JsonDeserializer<Object> _findDeserializer(DeserializationContext ctxt, String typeId) throws IOException
- Throws:
IOException
-
_findDefaultImplDeserializer
protected final JsonDeserializer<Object> _findDefaultImplDeserializer(DeserializationContext ctxt) throws IOException
- Throws:
IOException
-
_deserializeWithNativeTypeId
@Deprecated protected Object _deserializeWithNativeTypeId(com.fasterxml.jackson.core.JsonParser jp, DeserializationContext ctxt) throws IOException
Deprecated.Helper method called whenJsonParserindicates that it can use so-called native type ids. Assumption from there is that only native type ids are to be used.- Throws:
IOException- Since:
- 2.3
-
_deserializeWithNativeTypeId
protected Object _deserializeWithNativeTypeId(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt, Object typeId) throws IOException
Helper method called whenJsonParserindicates that it can use so-called native type ids, and such type id has been found.- Throws:
IOException- Since:
- 2.4
-
_handleUnknownTypeId
protected JavaType _handleUnknownTypeId(DeserializationContext ctxt, String typeId) throws IOException
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 aJsonMappingExceptionto indicate the problem; sub-classes may choose- Returns:
- If it is possible to resolve type id into a
JsonDeserializershould return that deserializer; otherwise throw an exception to indicate the problem. - Throws:
IOException- Since:
- 2.8
-
_handleMissingTypeId
protected JavaType _handleMissingTypeId(DeserializationContext ctxt, String extraDesc) throws IOException
- Throws:
IOException- Since:
- 2.9
-
-