fixed test failures with respect to null handling and PropertyTypeDescriptor usage for collection elements

This commit is contained in:
Juergen Hoeller
2010-06-23 19:31:51 +00:00
parent 27b04036a9
commit 8f8fc97b79
3 changed files with 17 additions and 12 deletions

View File

@@ -172,7 +172,7 @@ public class GenericConversionService implements ConversionService, ConverterReg
}
GenericConverter converter = getConverter(sourceType, targetType);
if (converter == null) {
if (targetType.getType().isInstance(source)) {
if (source == null || targetType.getType().isInstance(source)) {
logger.debug("No converter found - returning assignable source object as-is");
return source;
}

View File

@@ -117,4 +117,13 @@ public class PropertyTypeDescriptor extends TypeDescriptor {
return anns;
}
public TypeDescriptor forElementType(Class<?> elementType) {
if (elementType == null) {
return TypeDescriptor.UNKNOWN;
}
else {
return new PropertyTypeDescriptor(this.propertyDescriptor, getMethodParameter(), elementType);
}
}
}