take element/key/value objects into account for the best possible type descriptor

This commit is contained in:
Juergen Hoeller
2011-12-12 00:44:38 +00:00
parent 7398e0ea97
commit 4a7b96c4ca
2 changed files with 5 additions and 5 deletions

View File

@@ -529,7 +529,7 @@ class TypeConverterDelegate {
methodParam.increaseNestingLevel(); methodParam.increaseNestingLevel();
} }
Object convertedElement = convertIfNecessary( Object convertedElement = convertIfNecessary(
indexedPropertyName, null, element, elementType, typeDescriptor.getElementTypeDescriptor()); indexedPropertyName, null, element, elementType, typeDescriptor.getElementTypeDescriptor(element));
if (methodParam != null) { if (methodParam != null) {
methodParam.decreaseNestingLevel(); methodParam.decreaseNestingLevel();
} }
@@ -624,12 +624,12 @@ class TypeConverterDelegate {
methodParam.setTypeIndexForCurrentLevel(0); methodParam.setTypeIndexForCurrentLevel(0);
} }
Object convertedKey = convertIfNecessary(keyedPropertyName, null, key, keyType, Object convertedKey = convertIfNecessary(keyedPropertyName, null, key, keyType,
typeDescriptor.getMapKeyTypeDescriptor()); typeDescriptor.getMapKeyTypeDescriptor(key));
if (methodParam != null) { if (methodParam != null) {
methodParam.setTypeIndexForCurrentLevel(1); methodParam.setTypeIndexForCurrentLevel(1);
} }
Object convertedValue = convertIfNecessary(keyedPropertyName, null, value, valueType, Object convertedValue = convertIfNecessary(keyedPropertyName, null, value, valueType,
typeDescriptor.getMapValueTypeDescriptor()); typeDescriptor.getMapValueTypeDescriptor(value));
if (methodParam != null) { if (methodParam != null) {
methodParam.decreaseNestingLevel(); methodParam.decreaseNestingLevel();
} }

View File

@@ -324,7 +324,7 @@ public class TypeDescriptor {
*/ */
public TypeDescriptor getMapKeyTypeDescriptor(Object key) { public TypeDescriptor getMapKeyTypeDescriptor(Object key) {
TypeDescriptor keyType = getMapKeyTypeDescriptor(); TypeDescriptor keyType = getMapKeyTypeDescriptor();
return (keyType != TypeDescriptor.UNKNOWN ? keyType : TypeDescriptor.forObject(key)); return (!TypeDescriptor.UNKNOWN.equals(keyType) ? keyType : TypeDescriptor.forObject(key));
} }
/** /**
@@ -353,7 +353,7 @@ public class TypeDescriptor {
*/ */
public TypeDescriptor getMapValueTypeDescriptor(Object value) { public TypeDescriptor getMapValueTypeDescriptor(Object value) {
TypeDescriptor valueType = getMapValueTypeDescriptor(); TypeDescriptor valueType = getMapValueTypeDescriptor();
return (valueType != TypeDescriptor.UNKNOWN ? valueType : TypeDescriptor.forObject(value)); return (!TypeDescriptor.UNKNOWN.equals(valueType) ? valueType : TypeDescriptor.forObject(value));
} }
/** /**