use TypeDescriptor.forObject instead of constructor; enforce use of TypeDescriptor.valueOf through making the constructor private

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2683 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Juergen Hoeller
2009-12-15 20:18:31 +00:00
parent 7c138f1692
commit 55557b778f
4 changed files with 107 additions and 114 deletions
@@ -194,7 +194,7 @@ class TypeConverterDelegate {
// No custom editor but custom ConversionService specified?
ConversionService conversionService = this.propertyEditorRegistry.getConversionService();
if (editor == null && conversionService != null && convertedValue != null) {
TypeDescriptor sourceTypeDesc = new TypeDescriptor(convertedValue);
TypeDescriptor sourceTypeDesc = TypeDescriptor.forObject(convertedValue);
if (conversionService.canConvert(sourceTypeDesc, typeDescriptor)) {
return (T) conversionService.convert(convertedValue, sourceTypeDesc, typeDescriptor);
}