Polishing
Issue: SPR-11259
This commit is contained in:
@@ -456,6 +456,7 @@ public class GenericConversionService implements ConfigurableConversionService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Manages all converters registered with the service.
|
||||
*/
|
||||
@@ -614,12 +615,10 @@ public class GenericConversionService implements ConfigurableConversionService {
|
||||
this.converters.addFirst(converter);
|
||||
}
|
||||
|
||||
public GenericConverter getConverter(TypeDescriptor sourceType,
|
||||
TypeDescriptor targetType) {
|
||||
public GenericConverter getConverter(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
for (GenericConverter converter : this.converters) {
|
||||
if (!(converter instanceof ConditionalGenericConverter)
|
||||
|| ((ConditionalGenericConverter) converter).matches(sourceType,
|
||||
targetType)) {
|
||||
if (!(converter instanceof ConditionalGenericConverter) ||
|
||||
((ConditionalGenericConverter) converter).matches(sourceType, targetType)) {
|
||||
return converter;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ public class DefaultConversionTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStringToEnumWithSubclss() throws Exception {
|
||||
public void testStringToEnumWithSubclass() throws Exception {
|
||||
assertEquals(SubFoo.BAZ, conversionService.convert("BAZ", SubFoo.BAR.getClass()));
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ public class DefaultConversionTests {
|
||||
}
|
||||
|
||||
public static enum Foo {
|
||||
BAR, BAZ;
|
||||
BAR, BAZ
|
||||
}
|
||||
|
||||
public static enum SubFoo {
|
||||
|
||||
Reference in New Issue
Block a user