fixed formatter annotation lookup

This commit is contained in:
Juergen Hoeller
2009-09-08 01:35:36 +00:00
parent c63567c2ef
commit 6651ff0c55
2 changed files with 19 additions and 15 deletions

View File

@@ -161,8 +161,8 @@ public class GenericConversionService implements ConversionService, ConverterReg
ConversionExecutor getConversionExecutor(final Class<?> sourceClass, final TypeDescriptor targetType)
throws ConverterNotFoundException {
Assert.notNull(sourceClass, "The sourceType to convert from is required");
Assert.notNull(targetType, "The targetType to convert to is required");
Assert.notNull(sourceClass, "Source type to convert from is required");
Assert.notNull(targetType, "Target type to convert to is required");
if (targetType.getType() == null) {
return NoOpConversionExecutor.INSTANCE;
}
@@ -281,9 +281,7 @@ public class GenericConversionService implements ConversionService, ConverterReg
if (sourceType.isAssignableTo(targetType)) {
return NoOpConversionExecutor.INSTANCE;
}
Converter converter = findRegisteredConverter(
ClassUtils.resolvePrimitiveIfNecessary(sourceClass),
ClassUtils.resolvePrimitiveIfNecessary(targetType.getType()));
Converter converter = findConverter(sourceClass, targetType);
if (converter != null) {
return new StaticConversionExecutor(sourceType, targetType, converter);
}
@@ -368,7 +366,13 @@ public class GenericConversionService implements ConversionService, ConverterReg
return sourceMap;
}
protected <T> Converter findRegisteredConverter(Class<?> sourceType, Class<T> targetType) {
protected Converter findConverter(Class<?> sourceType, TypeDescriptor targetType) {
return findRegisteredConverter(
ClassUtils.resolvePrimitiveIfNecessary(sourceType),
ClassUtils.resolvePrimitiveIfNecessary(targetType.getType()));
}
private Converter findRegisteredConverter(Class<?> sourceType, Class<?> targetType) {
if (sourceType.isInterface()) {
LinkedList<Class> classQueue = new LinkedList<Class>();
classQueue.addFirst(sourceType);