polish
This commit is contained in:
parent
e6018afe8b
commit
ebbf63f4e0
|
|
@ -16,13 +16,13 @@
|
||||||
|
|
||||||
package org.springframework.context.support;
|
package org.springframework.context.support;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.springframework.beans.ResourceTestBean;
|
import org.springframework.beans.ResourceTestBean;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.core.convert.ConversionService;
|
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.ConverterFactory;
|
||||||
import org.springframework.core.convert.converter.GenericConverter;
|
import org.springframework.core.convert.converter.GenericConverter;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
import org.springframework.core.io.FileSystemResource;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Keith Donald
|
* @author Keith Donald
|
||||||
|
|
|
||||||
|
|
@ -433,12 +433,10 @@ public class TypeDescriptor {
|
||||||
if (this == TypeDescriptor.NULL || targetType == TypeDescriptor.NULL) {
|
if (this == TypeDescriptor.NULL || targetType == TypeDescriptor.NULL) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (isCollection()) {
|
if (isCollection() && targetType.isCollection() || isArray() && targetType.isArray()) {
|
||||||
return targetType.isCollection() && getElementTypeDescriptor().isAssignableTo(targetType.getElementTypeDescriptor());
|
return targetType.getType().isAssignableFrom(getType()) && getElementTypeDescriptor().isAssignableTo(targetType.getElementTypeDescriptor());
|
||||||
} else if (isMap()) {
|
} else if (isMap() && targetType.isMap()) {
|
||||||
return targetType.isMap() && getMapKeyTypeDescriptor().isAssignableTo(targetType.getMapKeyTypeDescriptor()) && getMapValueTypeDescriptor().isAssignableTo(targetType.getMapValueTypeDescriptor());
|
return targetType.getType().isAssignableFrom(getType()) && getMapKeyTypeDescriptor().isAssignableTo(targetType.getMapKeyTypeDescriptor()) && getMapValueTypeDescriptor().isAssignableTo(targetType.getMapValueTypeDescriptor());
|
||||||
} else if (isArray()) {
|
|
||||||
return targetType.isArray() && getElementTypeDescriptor().isAssignableTo(targetType.getElementTypeDescriptor());
|
|
||||||
} else {
|
} else {
|
||||||
return targetType.getObjectType().isAssignableFrom(getObjectType());
|
return targetType.getObjectType().isAssignableFrom(getObjectType());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue