This commit is contained in:
Keith Donald 2010-04-17 06:47:08 +00:00
parent e6018afe8b
commit ebbf63f4e0
2 changed files with 6 additions and 9 deletions

View File

@ -16,13 +16,13 @@
package org.springframework.context.support;
import static org.junit.Assert.assertTrue;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.beans.ResourceTestBean;
import org.springframework.context.ApplicationContext;
import org.springframework.core.convert.ConversionService;
@ -31,7 +31,6 @@ import org.springframework.core.convert.converter.Converter;
import org.springframework.core.convert.converter.ConverterFactory;
import org.springframework.core.convert.converter.GenericConverter;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource;
/**
* @author Keith Donald

View File

@ -433,12 +433,10 @@ public class TypeDescriptor {
if (this == TypeDescriptor.NULL || targetType == TypeDescriptor.NULL) {
return true;
}
if (isCollection()) {
return targetType.isCollection() && getElementTypeDescriptor().isAssignableTo(targetType.getElementTypeDescriptor());
} else if (isMap()) {
return targetType.isMap() && getMapKeyTypeDescriptor().isAssignableTo(targetType.getMapKeyTypeDescriptor()) && getMapValueTypeDescriptor().isAssignableTo(targetType.getMapValueTypeDescriptor());
} else if (isArray()) {
return targetType.isArray() && getElementTypeDescriptor().isAssignableTo(targetType.getElementTypeDescriptor());
if (isCollection() && targetType.isCollection() || isArray() && targetType.isArray()) {
return targetType.getType().isAssignableFrom(getType()) && getElementTypeDescriptor().isAssignableTo(targetType.getElementTypeDescriptor());
} else if (isMap() && targetType.isMap()) {
return targetType.getType().isAssignableFrom(getType()) && getMapKeyTypeDescriptor().isAssignableTo(targetType.getMapKeyTypeDescriptor()) && getMapValueTypeDescriptor().isAssignableTo(targetType.getMapValueTypeDescriptor());
} else {
return targetType.getObjectType().isAssignableFrom(getObjectType());
}