Class TypeDeserializerBase

java.lang.Object
tools.jackson.databind.jsontype.TypeDeserializer
tools.jackson.databind.jsontype.impl.TypeDeserializerBase
Direct Known Subclasses:
AsArrayTypeDeserializer, AsWrapperTypeDeserializer

public abstract class TypeDeserializerBase extends TypeDeserializer
Base class for all standard Jackson TypeDeserializers.
  • Field Details

    • _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 when forProperty(tools.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,ValueDeserializer<Object>> _deserializers
      For efficient operation we will lazily build mappings from type ids to actual deserializers, once needed.
    • _defaultImplDeserializer

      protected ValueDeserializer<Object> _defaultImplDeserializer
  • Constructor Details

  • Method Details

    • forProperty

      public abstract TypeDeserializer forProperty(BeanProperty prop)
      Description copied from class: TypeDeserializer
      Method 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 (for Collection or Map valued properties).
      Specified by:
      forProperty in class TypeDeserializer
    • getTypeInclusion

      public abstract JsonTypeInfo.As getTypeInclusion()
      Description copied from class: TypeDeserializer
      Accessor for type information inclusion method that deserializer uses; indicates how type information is (expected to be) embedded in JSON input.
      Specified by:
      getTypeInclusion in class TypeDeserializer
    • baseTypeName

      public String baseTypeName()
    • getPropertyName

      public final String getPropertyName()
      Description copied from class: TypeDeserializer
      Name of property that contains type information, if property-based inclusion is used.
      Specified by:
      getPropertyName in class TypeDeserializer
    • getTypeIdResolver

      public TypeIdResolver getTypeIdResolver()
      Description copied from class: TypeDeserializer
      Accessor for object that handles conversions between types and matching type ids.
      Specified by:
      getTypeIdResolver in class TypeDeserializer
    • getDefaultImpl

      public Class<?> getDefaultImpl()
      Description copied from class: TypeDeserializer
      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)
      Specified by:
      getDefaultImpl in class TypeDeserializer
    • hasDefaultImpl

      public boolean hasDefaultImpl()
      Overrides:
      hasDefaultImpl in class TypeDeserializer
    • baseType

      public JavaType baseType()
      Since:
      2.9
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • _findDeserializer

      protected final ValueDeserializer<Object> _findDeserializer(DeserializationContext ctxt, String typeId)
    • _findDefaultImplDeserializer

      protected final ValueDeserializer<Object> _findDefaultImplDeserializer(DeserializationContext ctxt)
    • _deserializeWithNativeTypeId

      protected Object _deserializeWithNativeTypeId(tools.jackson.core.JsonParser p, DeserializationContext ctxt, Object typeId) throws tools.jackson.core.JacksonException
      Helper method called when JsonParser indicates that it can use so-called native type ids, and such type id has been found.
      Throws:
      tools.jackson.core.JacksonException
    • _handleUnknownTypeId

      protected JavaType _handleUnknownTypeId(DeserializationContext ctxt, String typeId) throws tools.jackson.core.JacksonException
      Helper method called when given type id cannot be resolved into concrete deserializer either directly (using given TypeIdResolver), or using default type. Default implementation simply throws a DatabindException to indicate the problem; sub-classes may choose
      Returns:
      If it is possible to resolve type id into a ValueDeserializer should return that deserializer; otherwise throw an exception to indicate the problem.
      Throws:
      tools.jackson.core.JacksonException
    • _handleMissingTypeId

      protected JavaType _handleMissingTypeId(DeserializationContext ctxt, String extraDesc) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException