type = (T) ((MapLikeType) type).narrowKey(keyClass);
} catch (IllegalArgumentException iae) {
throw new JsonMappingException("Failed to narrow key type "+type+" with key-type annotation ("+keyClass.getName()+"): "+iae.getMessage(), null, iae);
}
}
JavaType keyType = type.getKeyType();
/* 21-Mar-2011, tatu: ... and associated deserializer too (unless already assigned)
* (not 100% why or how, but this does seem to get called more than once, which
* is not good: for now, let's just avoid errors)
*/
if (keyType != null && keyType.getValueHandler() == null) {
Class<? extends KeyDeserializer> kdClass = intr.findKeyDeserializer(a);
if (kdClass != null && kdClass != KeyDeserializer.None.class) {
KeyDeserializer kd = config.keyDeserializerInstance(a, kdClass);
// !!! TODO: For 2.0, change to use this instead:
/*
type = (T) ((MapLikeType) type).withKeyValueHandler(kd);
keyType = type.getKeyType(); // just in case it's used below
*/
keyType.setValueHandler(kd);
}
}
// and finally content class; only applicable to structured types
Class<?> cc = intr.findDeserializationContentType(a, type.getContentType(), propName);
if (cc != null) {
try {
type = (T) type.narrowContentsBy(cc);
} catch (IllegalArgumentException iae) {
throw new JsonMappingException("Failed to narrow content type "+type+" with content-type annotation ("+cc.getName()+"): "+iae.getMessage(), null, iae);
}
}
// ... as well as deserializer for contents:
JavaType contentType = type.getContentType();
if (contentType.getValueHandler() == null) { // as with above, avoid resetting (which would trigger exception)
Class<? extends JsonDeserializer<?>> cdClass = intr.findContentDeserializer(a);
if (cdClass != null && cdClass != JsonDeserializer.None.class) {
JsonDeserializer<Object> cd = config.deserializerInstance(a, cdClass);
// !!! TODO: For 2.0, change to use this instead:
/*