com.fasterxml.jackson.databind.jsontype

## Class TypeDeserializer

- java.lang.Object
- - com.fasterxml.jackson.databind.jsontype.TypeDeserializer

- Direct Known Subclasses:
    TypeDeserializerBase

      public abstract class TypeDeserializer
      extends java.lang.Object

  Interface for deserializing type information from JSON content, to type-safely deserialize data into correct polymorphic instance (when type inclusion has been enabled for type handled).

  Separate deserialization methods are needed because serialized form for inclusion mechanism `JsonTypeInfo.As.PROPERTY` is slighty different if value is not expressed as JSON Object: and as such both type deserializer and serializer need to JSON Object form (array, object or other (== scalar)) being used.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TypeDeserializer()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.Object` | `deserializeIfNatural(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt, java.lang.Class<?> base)`
    `static java.lang.Object` | `deserializeIfNatural(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt, JavaType baseType)` Helper method used to check if given parser might be pointing to a "natural" value, and one that would be acceptable as the result value (compatible with declared base type)
    `abstract java.lang.Object` | `deserializeTypedFromAny(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt)` Method called to let this type deserializer handle deserialization of "typed" object, when value itself may have been serialized using any kind of JSON value (Array, Object, scalar).
    `abstract java.lang.Object` | `deserializeTypedFromArray(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt)` Method called to let this type deserializer handle deserialization of "typed" object, when value itself is serialized as JSON Array (regardless of Java type).
    `abstract java.lang.Object` | `deserializeTypedFromObject(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt)` Method called to let this type deserializer handle deserialization of "typed" object, when value itself is serialized as JSON Object (regardless of Java type).
    `abstract java.lang.Object` | `deserializeTypedFromScalar(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt)` Method called to let this type deserializer handle deserialization of "typed" object, when value itself is serialized as a scalar JSON value (something other than Array or Object), regardless of Java type.
    `abstract TypeDeserializer` | `forProperty(BeanProperty prop)` Method called to create contextual version, to be used for values of given property.
    `abstract java.lang.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 can not be resolved)
    `abstract java.lang.String` | `getPropertyName()` Name of property that contains type information, if property-based inclusion is used.
    `abstract TypeIdResolver` | `getTypeIdResolver()` Accessor for object that handles conversions between types and matching type ids.
    `abstract com.fasterxml.jackson.annotation.JsonTypeInfo.As` | `getTypeInclusion()` Accessor for type information inclusion method that deserializer uses; indicates how type information is (expected to be) embedded in JSON input.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TypeDeserializer

          public TypeDeserializer()

  - ### Method Detail

    - #### forProperty

          public abstract TypeDeserializer forProperty(BeanProperty prop)

      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).

    - #### getTypeInclusion

          public abstract com.fasterxml.jackson.annotation.JsonTypeInfo.As getTypeInclusion()

      Accessor for type information inclusion method that deserializer uses; indicates how type information is (expected to be) embedded in JSON input.

    - #### getPropertyName

          public abstract java.lang.String getPropertyName()

      Name of property that contains type information, if property-based inclusion is used.

    - #### getTypeIdResolver

          public abstract TypeIdResolver getTypeIdResolver()

      Accessor for object that handles conversions between types and matching type ids.

    - #### getDefaultImpl

          public abstract java.lang.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 can not be resolved)

    - #### deserializeTypedFromObject

          public abstract java.lang.Object deserializeTypedFromObject(com.fasterxml.jackson.core.JsonParser p,
                                                    DeserializationContext ctxt)
                                                               throws java.io.IOException

      Method called to let this type deserializer handle deserialization of "typed" object, when value itself is serialized as JSON Object (regardless of Java type). Method needs to figure out intended polymorphic type, locate `JsonDeserializer` to use, and call it with JSON data to deserializer (which does not contain type information).
      Throws:
        `java.io.IOException`

    - #### deserializeTypedFromArray

          public abstract java.lang.Object deserializeTypedFromArray(com.fasterxml.jackson.core.JsonParser p,
                                                   DeserializationContext ctxt)
                                                              throws java.io.IOException

      Method called to let this type deserializer handle deserialization of "typed" object, when value itself is serialized as JSON Array (regardless of Java type). Method needs to figure out intended polymorphic type, locate `JsonDeserializer` to use, and call it with JSON data to deserializer (which does not contain type information).
      Throws:
        `java.io.IOException`

    - #### deserializeTypedFromScalar

          public abstract java.lang.Object deserializeTypedFromScalar(com.fasterxml.jackson.core.JsonParser p,
                                                    DeserializationContext ctxt)
                                                               throws java.io.IOException

      Method called to let this type deserializer handle deserialization of "typed" object, when value itself is serialized as a scalar JSON value (something other than Array or Object), regardless of Java type. Method needs to figure out intended polymorphic type, locate `JsonDeserializer` to use, and call it with JSON data to deserializer (which does not contain type information).
      Throws:
        `java.io.IOException`

    - #### deserializeTypedFromAny

          public abstract java.lang.Object deserializeTypedFromAny(com.fasterxml.jackson.core.JsonParser p,
                                                 DeserializationContext ctxt)
                                                            throws java.io.IOException

      Method called to let this type deserializer handle deserialization of "typed" object, when value itself may have been serialized using any kind of JSON value (Array, Object, scalar). Should only be called if JSON serialization is polymorphic (not Java type); for example when using JSON node representation, or "untyped" Java object (which may be Map, Collection, wrapper/primitive etc).
      Throws:
        `java.io.IOException`

    - #### deserializeIfNatural

          public static java.lang.Object deserializeIfNatural(com.fasterxml.jackson.core.JsonParser p,
                                              DeserializationContext ctxt,
                                              JavaType baseType)
                                                       throws java.io.IOException

      Helper method used to check if given parser might be pointing to a "natural" value, and one that would be acceptable as the result value (compatible with declared base type)
      Throws:
        `java.io.IOException`

    - #### deserializeIfNatural

          public static java.lang.Object deserializeIfNatural(com.fasterxml.jackson.core.JsonParser p,
                                              DeserializationContext ctxt,
                                              java.lang.Class<?> base)
                                                       throws java.io.IOException

      Throws:
        `java.io.IOException`