Class AsDeductionTypeDeserializer
- java.lang.Object
-
- com.fasterxml.jackson.databind.jsontype.TypeDeserializer
-
- com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase
-
- com.fasterxml.jackson.databind.jsontype.impl.AsArrayTypeDeserializer
-
- com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer
-
- com.fasterxml.jackson.databind.jsontype.impl.AsDeductionTypeDeserializer
-
- All Implemented Interfaces:
java.io.Serializable
public class AsDeductionTypeDeserializer extends AsPropertyTypeDeserializer
ATypeDeserializercapable of deducing polymorphic types based on the fields available. Deduction is limited to the names of child properties (not their values or, consequently, any nested descendants). Exceptions will be thrown if not enough unique information is present to select a single subtype.The current deduction process does not support pojo-hierarchies such that the absence of child fields infers a parent type. That is, every deducible subtype MUST have some unique fields and the input data MUST contain said unique fields to provide a positive match.
- Since:
- 2.12
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.BitSetEMPTY_CLASS_FINGERPRINTprivate java.util.Map<java.lang.String,java.lang.Integer>fieldBitIndexprivate static longserialVersionUIDprivate java.util.Map<java.util.BitSet,java.lang.String>subtypeFingerprints-
Fields inherited from class com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer
_inclusion, _msgForMissingId, _strictTypeIdHandling
-
Fields inherited from class com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase
_baseType, _defaultImpl, _defaultImplDeserializer, _deserializers, _idResolver, _property, _typeIdVisible, _typePropertyName
-
-
Constructor Summary
Constructors Constructor Description AsDeductionTypeDeserializer(JavaType bt, TypeIdResolver idRes, JavaType defaultImpl, DeserializationConfig config, java.util.Collection<NamedType> subtypes)AsDeductionTypeDeserializer(AsDeductionTypeDeserializer src, BeanProperty property)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Map<java.util.BitSet,java.lang.String>buildFingerprints(DeserializationConfig config, java.util.Collection<NamedType> subtypes)java.lang.ObjectdeserializeTypedFromObject(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt)This is the trickiest thing to handle, since property we are looking for may be anywhere...TypeDeserializerforProperty(BeanProperty prop)Method called to create contextual version, to be used for values of given property.private static voidprune(java.util.List<java.util.BitSet> candidates, int bit)-
Methods inherited from class com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer
_deserializeTypedForId, _deserializeTypedUsingDefaultImpl, _deserializeTypedUsingDefaultImpl, deserializeTypedFromAny, getTypeInclusion
-
Methods inherited from class com.fasterxml.jackson.databind.jsontype.impl.AsArrayTypeDeserializer
_deserialize, _locateTypeId, _usesExternalId, deserializeTypedFromArray, deserializeTypedFromScalar
-
Methods inherited from class com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase
_deserializeWithNativeTypeId, _deserializeWithNativeTypeId, _findDefaultImplDeserializer, _findDeserializer, _handleMissingTypeId, _handleUnknownTypeId, baseType, baseTypeName, getDefaultImpl, getPropertyName, getTypeIdResolver, hasDefaultImpl, toString
-
Methods inherited from class com.fasterxml.jackson.databind.jsontype.TypeDeserializer
deserializeIfNatural, deserializeIfNatural
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
EMPTY_CLASS_FINGERPRINT
private static final java.util.BitSet EMPTY_CLASS_FINGERPRINT
-
fieldBitIndex
private final java.util.Map<java.lang.String,java.lang.Integer> fieldBitIndex
-
subtypeFingerprints
private final java.util.Map<java.util.BitSet,java.lang.String> subtypeFingerprints
-
-
Constructor Detail
-
AsDeductionTypeDeserializer
public AsDeductionTypeDeserializer(JavaType bt, TypeIdResolver idRes, JavaType defaultImpl, DeserializationConfig config, java.util.Collection<NamedType> subtypes)
-
AsDeductionTypeDeserializer
public AsDeductionTypeDeserializer(AsDeductionTypeDeserializer src, BeanProperty property)
-
-
Method Detail
-
forProperty
public 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).- Overrides:
forPropertyin classAsPropertyTypeDeserializer
-
buildFingerprints
protected java.util.Map<java.util.BitSet,java.lang.String> buildFingerprints(DeserializationConfig config, java.util.Collection<NamedType> subtypes)
-
deserializeTypedFromObject
public java.lang.Object deserializeTypedFromObject(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt) throws java.io.IOExceptionDescription copied from class:AsPropertyTypeDeserializerThis is the trickiest thing to handle, since property we are looking for may be anywhere...- Overrides:
deserializeTypedFromObjectin classAsPropertyTypeDeserializer- Throws:
java.io.IOException
-
prune
private static void prune(java.util.List<java.util.BitSet> candidates, int bit)
-
-