Class JsonTypeAndClassDeserializer

  • All Implemented Interfaces:
    java.io.Serializable

    public class JsonTypeAndClassDeserializer
    extends com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer
    Custom JSON deserializer that recognizes objects with both @type and @class fields. Deserializing objects with @class field requires and appropriate entry in classValueToClassObjectsMapping. If @class value is not found in the mapping then a JSON object is not deserialized and an exception is thrown. If the mapping is found then a class that is assignable to the deserialization base type is picked. If there is no such class or there is more than one then an exception is thrown. Please remember that @class field is now deprecated and the support for that field is maintained only for backwards compatibility.
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer

        _inclusion
      • Fields inherited from class com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase

        _baseType, _defaultImpl, _defaultImplDeserializer, _deserializers, _idResolver, _property, _typeIdVisible, _typePropertyName
    • Constructor Summary

      Constructors 
      Constructor Description
      JsonTypeAndClassDeserializer​(JsonTypeAndClassDeserializer src, com.fasterxml.jackson.databind.BeanProperty property)  
      JsonTypeAndClassDeserializer​(com.fasterxml.jackson.databind.JavaType type, java.util.Collection<com.fasterxml.jackson.databind.jsontype.NamedType> subtypes, com.fasterxml.jackson.databind.jsontype.TypeIdResolver idRes, java.lang.String typePropName, boolean typeIdVisible)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object deserializeTypedFromAny​(com.fasterxml.jackson.core.JsonParser jp, com.fasterxml.jackson.databind.DeserializationContext ctxt)  
      java.lang.Object deserializeTypedFromArray​(com.fasterxml.jackson.core.JsonParser jp, com.fasterxml.jackson.databind.DeserializationContext ctxt)  
      java.lang.Object deserializeTypedFromObject​(com.fasterxml.jackson.core.JsonParser jp, com.fasterxml.jackson.databind.DeserializationContext ctxt)  
      java.lang.Object deserializeWithoutType​(com.fasterxml.jackson.core.JsonParser jp, com.fasterxml.jackson.databind.DeserializationContext ctxt, com.fasterxml.jackson.databind.util.TokenBuffer tb)  
      com.fasterxml.jackson.databind.jsontype.TypeDeserializer forProperty​(com.fasterxml.jackson.databind.BeanProperty prop)  
      void setClassValueToClassObjectsMapping​(IJsonClassValueToClassObjectsMapping classValueToClassObjectsMapping)  
      • Methods inherited from class com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer

        _deserializeTypedForId, _deserializeTypedUsingDefaultImpl, getTypeInclusion
      • Methods inherited from class com.fasterxml.jackson.databind.jsontype.impl.AsArrayTypeDeserializer

        _deserialize, _locateTypeId, _usesExternalId, deserializeTypedFromScalar
      • Methods inherited from class com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase

        _deserializeWithNativeTypeId, _deserializeWithNativeTypeId, _findDefaultImplDeserializer, _findDeserializer, _handleMissingTypeId, _handleUnknownTypeId, baseType, baseTypeName, getDefaultImpl, getPropertyName, getTypeIdResolver, toString
      • Methods inherited from class com.fasterxml.jackson.databind.jsontype.TypeDeserializer

        deserializeIfNatural, deserializeIfNatural
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • JsonTypeAndClassDeserializer

        public JsonTypeAndClassDeserializer​(JsonTypeAndClassDeserializer src,
                                            com.fasterxml.jackson.databind.BeanProperty property)
      • JsonTypeAndClassDeserializer

        public JsonTypeAndClassDeserializer​(com.fasterxml.jackson.databind.JavaType type,
                                            java.util.Collection<com.fasterxml.jackson.databind.jsontype.NamedType> subtypes,
                                            com.fasterxml.jackson.databind.jsontype.TypeIdResolver idRes,
                                            java.lang.String typePropName,
                                            boolean typeIdVisible)
    • Method Detail

      • forProperty

        public com.fasterxml.jackson.databind.jsontype.TypeDeserializer forProperty​(com.fasterxml.jackson.databind.BeanProperty prop)
        Overrides:
        forProperty in class com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer
      • deserializeTypedFromAny

        public java.lang.Object deserializeTypedFromAny​(com.fasterxml.jackson.core.JsonParser jp,
                                                        com.fasterxml.jackson.databind.DeserializationContext ctxt)
                                                 throws java.io.IOException,
                                                        com.fasterxml.jackson.core.JsonProcessingException
        Overrides:
        deserializeTypedFromAny in class com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer
        Throws:
        java.io.IOException
        com.fasterxml.jackson.core.JsonProcessingException
      • deserializeTypedFromArray

        public java.lang.Object deserializeTypedFromArray​(com.fasterxml.jackson.core.JsonParser jp,
                                                          com.fasterxml.jackson.databind.DeserializationContext ctxt)
                                                   throws java.io.IOException,
                                                          com.fasterxml.jackson.core.JsonProcessingException
        Overrides:
        deserializeTypedFromArray in class com.fasterxml.jackson.databind.jsontype.impl.AsArrayTypeDeserializer
        Throws:
        java.io.IOException
        com.fasterxml.jackson.core.JsonProcessingException
      • deserializeTypedFromObject

        public java.lang.Object deserializeTypedFromObject​(com.fasterxml.jackson.core.JsonParser jp,
                                                           com.fasterxml.jackson.databind.DeserializationContext ctxt)
                                                    throws java.io.IOException,
                                                           com.fasterxml.jackson.core.JsonProcessingException
        Overrides:
        deserializeTypedFromObject in class com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer
        Throws:
        java.io.IOException
        com.fasterxml.jackson.core.JsonProcessingException
      • deserializeWithoutType

        public java.lang.Object deserializeWithoutType​(com.fasterxml.jackson.core.JsonParser jp,
                                                       com.fasterxml.jackson.databind.DeserializationContext ctxt,
                                                       com.fasterxml.jackson.databind.util.TokenBuffer tb)
                                                throws java.io.IOException,
                                                       com.fasterxml.jackson.core.JsonProcessingException
        Throws:
        java.io.IOException
        com.fasterxml.jackson.core.JsonProcessingException