targetType = replaceWithMappedTypeForPath(targetType);
Object target;
boolean isTargetTypeMap = true;
boolean isTargetRealTypeMap = true;
ClassDescriptor targetTypeClassDescriptor = null;
if (targetType != null) {
targetTypeClassDescriptor = ClassIntrospector.lookup(targetType);
// find if the target is really a map
// because when classMetadataName != null we are forcing
// map usage locally in this method
isTargetRealTypeMap = targetTypeClassDescriptor.isMap();
}
if (isTargetRealTypeMap) {
// resolve keys only for real maps
path.push(KEYS);
valueKeyType = replaceWithMappedTypeForPath(valueKeyType);
path.pop();
}
if (classMetadataName == null) {
// create instance of target type, no 'class' information
target = newObjectInstance(targetType);
isTargetTypeMap = isTargetRealTypeMap;
} else {
// all beans will be created first as a map
target = new HashMap();
}
boolean koma = false;
mainloop:
while (true) {
skipWhiteSpaces();
char c = input[ndx];
if (c == '}') {
if (koma) {
syntaxError("Trailing comma");
}
ndx++;
break;
}
koma = false;
String key = parseString();
skipWhiteSpaces();
consume(':');
skipWhiteSpaces();
// read the type of the simple property
PropertyDescriptor pd = null;
Class propertyType = null;
Class keyType = null;
Class componentType = null;
// resolve simple property
if (!isTargetRealTypeMap) {
// replace key with real property value
key = JoddJson.annotationManager.resolveRealName(targetType, key);
}
if (!isTargetTypeMap) {
pd = targetTypeClassDescriptor.getPropertyDescriptor(key, true);
if (pd != null) {
propertyType = pd.getType();
keyType = pd.resolveKeyType(true);
componentType = pd.resolveComponentType(true);