Browse Source

polish

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3260 50f2f4bb-b051-0410-bef5-90022cba6387
pull/1/head
Keith Donald 16 years ago
parent
commit
ef2409017c
  1. 5
      org.springframework.context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java
  2. 10
      org.springframework.core/src/main/java/org/springframework/core/convert/TypeDescriptor.java

5
org.springframework.context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java

@ -16,13 +16,13 @@ @@ -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; @@ -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

10
org.springframework.core/src/main/java/org/springframework/core/convert/TypeDescriptor.java

@ -433,12 +433,10 @@ public class TypeDescriptor { @@ -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());
}

Loading…
Cancel
Save