Browse Source

updated for change in conversion service api; source type desc now required

pull/23217/head
Keith Donald 15 years ago
parent
commit
45c542e51e
  1. 11
      org.springframework.beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java

11
org.springframework.beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java

@ -166,16 +166,17 @@ class TypeConverterDelegate { @@ -166,16 +166,17 @@ class TypeConverterDelegate {
// No custom editor but custom ConversionService specified?
ConversionService conversionService = this.propertyEditorRegistry.getConversionService();
if (editor == null && conversionService != null && convertedValue != null) {
TypeDescriptor typeDesc;
TypeDescriptor sourceTypeDesc = TypeDescriptor.valueOf(convertedValue.getClass());
TypeDescriptor targetTypeDesc;
if (methodParam != null) {
typeDesc = (descriptor != null ?
targetTypeDesc = (descriptor != null ?
new BeanTypeDescriptor(methodParam, descriptor) : new TypeDescriptor(methodParam));
}
else {
typeDesc = TypeDescriptor.valueOf(requiredType);
targetTypeDesc = TypeDescriptor.valueOf(requiredType);
}
if (conversionService.matches(convertedValue.getClass(), typeDesc)) {
return (T) conversionService.convert(convertedValue, typeDesc);
if (conversionService.canConvert(sourceTypeDesc, targetTypeDesc)) {
return (T) conversionService.convert(convertedValue, sourceTypeDesc, targetTypeDesc);
}
}

Loading…
Cancel
Save