mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-26 17:09:05 +00:00
refined generic converter concept
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1932 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
+2
-12
@@ -101,21 +101,11 @@ public class ExpressionTestsUsingCoreConversionService extends ExpressionTestCas
|
||||
private final DefaultConversionService service = new DefaultConversionService();
|
||||
|
||||
public boolean canConvert(Class<?> sourceType, Class<?> targetType) {
|
||||
return this.service.canConvert(sourceType, TypeDescriptor.valueOf(targetType));
|
||||
return this.service.canConvert(sourceType, targetType);
|
||||
}
|
||||
|
||||
public boolean canConvert(Class<?> sourceType, TypeDescriptor typeDescriptor) {
|
||||
return this.service.canConvert(sourceType, typeDescriptor);
|
||||
}
|
||||
|
||||
@SuppressWarnings("cast")
|
||||
public <T> T convertValue(Object value, Class<T> targetType) throws EvaluationException {
|
||||
return (T) this.service.convert(value,TypeDescriptor.valueOf(targetType));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object convertValue(Object value, TypeDescriptor typeDescriptor) throws EvaluationException {
|
||||
return this.service.convert(value, typeDescriptor);
|
||||
return this.service.convert(value, TypeDescriptor.forObject(value), typeDescriptor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user