/* As per [Issue#305], need to provide contextual info. But for
* backwards compatibility, let's start by only supporting this
* for base class, not via interface. Later on we can add this
* to the interface, assuming deprecation at base class helps.
*/
JavaType type;
if (_idResolver instanceof TypeIdResolverBase) {
type = ((TypeIdResolverBase) _idResolver).typeFromId(ctxt, typeId);
} else {
type = _idResolver.typeFromId(typeId);
}
if (type == null) {
// As per [JACKSON-614], use the default impl if no type id available:
if (_defaultImpl == null) {
throw ctxt.unknownTypeException(_baseType, typeId);
}
deser = _findDefaultImplDeserializer(ctxt);
} else {
/* 16-Dec-2010, tatu: Since nominal type we get here has no (generic) type parameters,
* we actually now need to explicitly narrow from base type (which may have parameterization)
* using raw type.
*
* One complication, though; can not change 'type class' (simple type to container); otherwise
* we may try to narrow a SimpleType (Object.class) into MapType (Map.class), losing actual
* type in process (getting SimpleType of Map.class which will not work as expected)
*/
if (_baseType != null && _baseType.getClass() == type.getClass()) {
type = _baseType.narrowBy(type.getRawClass());
}
deser = ctxt.findContextualValueDeserializer(type, _property);
}
_deserializers.put(typeId, deser);
}