polishing

This commit is contained in:
Juergen Hoeller 2009-09-24 10:21:40 +00:00
parent 501a1ea9af
commit 38110d35d2
3 changed files with 14 additions and 7 deletions

View File

@ -24,8 +24,8 @@ import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.util.Assert;
/**
* A {@link ScopeMetadataResolver} implementation that (by default) checks for
* the presence of the {@link Scope} annotation on the bean class.
* A {@link ScopeMetadataResolver} implementation that by default checks for
* the presence of Spring's {@link Scope} annotation on the bean class.
*
* <p>The exact type of annotation that is checked for is configurable via the
* {@link #setScopeAnnotationType(Class)} property.

View File

@ -40,6 +40,7 @@ public class FormattingConversionServiceAdapter extends GenericConversionService
private final FormatterRegistry formatterRegistry;
/**
* Create a new FormattingConversionServiceAdapter for the given FormatterRegistry.
* @param formatterRegistry the FormatterRegistry to wrap
@ -49,11 +50,13 @@ public class FormattingConversionServiceAdapter extends GenericConversionService
this.formatterRegistry = formatterRegistry;
if (formatterRegistry instanceof GenericFormatterRegistry) {
setParent(((GenericFormatterRegistry) formatterRegistry).getConversionService());
} else {
}
else {
setParent(new DefaultConversionService());
}
}
@Override
protected GenericConverter getConverter(TypeDescriptor sourceType, TypeDescriptor targetType) {
if (String.class.equals(sourceType.getType())) {
@ -65,6 +68,7 @@ public class FormattingConversionServiceAdapter extends GenericConversionService
return super.getConverter(sourceType, targetType);
}
/**
* Adapter that exposes the Converter interface on top of a given Formatter.
*/
@ -79,7 +83,8 @@ public class FormattingConversionServiceAdapter extends GenericConversionService
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
try {
return this.formatter.parse((String) source, LocaleContextHolder.getLocale());
} catch (ParseException ex) {
}
catch (ParseException ex) {
throw new IllegalArgumentException("Could not convert formatted value '" + source + "'", ex);
}
}

View File

@ -245,10 +245,12 @@ public class GenericFormatterRegistry implements FormatterRegistry, ApplicationC
if (arg instanceof Class) {
return (Class) arg;
}
} else if (Formatter.class.isAssignableFrom((Class) rawType)) {
}
else if (Formatter.class.isAssignableFrom((Class) rawType)) {
return getFormattedObjectType((Class) rawType);
}
} else if (Formatter.class.isAssignableFrom((Class) ifc)) {
}
else if (Formatter.class.isAssignableFrom((Class) ifc)) {
return getFormattedObjectType((Class) ifc);
}
}