if (keyName.equals(classMetadataName)) {
continue;
}
}
PropertyDescriptor pd = cd.getPropertyDescriptor(keyName, declared);
if (!targetIsMap && pd == null) {
// target property does not exist, continue
continue;
}
// value is one of JSON basic types, like Number, Map, List...
Object value = map.get(key);
Class propertyType = pd == null ? null : pd.getType();
Class componentType = pd == null ? null : pd.resolveComponentType(true);
if (value != null) {
if (value instanceof List) {
if (componentType != null && componentType != String.class) {
value = generifyList((List) value, componentType);
}
}
else if (value instanceof Map) {
// if the value we want to inject is a Map...
if (ReflectUtil.isTypeOf(propertyType, Map.class) == false) {
// ... and if target is NOT a map
value = map2bean((Map) value, propertyType);
}
else {
// target is also a Map, but we might need to generify it
Class keyType = pd == null ? null : pd.resolveKeyType(true);
if (keyType != String.class || componentType != String.class) {
// generify
value = generifyMap((Map) value, keyType, componentType);
}