提交 d13567bc 编写于 作者: K Keith Donald

added support for null conversion point type

上级 18be2ffa
......@@ -158,6 +158,10 @@ public class GenericTypeConverter implements TypeConverter, ConverterRegistry {
throws ConverterNotFoundException {
Assert.notNull(sourceClass, "The sourceType to convert from is required");
Assert.notNull(targetType, "The targetType to convert to is required");
if (targetType.getType() == null) {
// TODO for Andy - is this correct way to handle the Null TypedValue?
return NoOpConversionExecutor.INSTANCE;
}
ConversionPoint sourceType = ConversionPoint.valueOf(sourceClass);
if (sourceType.isArray()) {
if (targetType.isArray()) {
......
......@@ -80,7 +80,18 @@ public class GenericTypeConverterTests {
public void convertNull() {
assertNull(converter.convert(null, Integer.class));
}
@Test
public void convertNullTargetClass() {
assertEquals("3", converter.convert("3", (Class<?>)null));
}
@Test
public void convertNullConversionPointType() {
assertEquals("3", converter.convert("3", ConversionPoint.NULL));
}
@Test
public void convertWrongTypeArgument() {
converter.addConverter(new StringToInteger());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册