diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/TypeDescriptor.java b/org.springframework.core/src/main/java/org/springframework/core/convert/TypeDescriptor.java index 7012842ad9..2d0e48a5b2 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/TypeDescriptor.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/TypeDescriptor.java @@ -26,7 +26,6 @@ import org.springframework.core.GenericCollectionTypeResolver; import org.springframework.core.MethodParameter; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; -import org.springframework.util.ObjectUtils; /** * Context about a type to convert to. @@ -136,7 +135,7 @@ public class TypeDescriptor { /** * Determine the declared (non-generic) type of the wrapped parameter/field. - * @return the declared type + * @return the declared type, or null if this is {@link TypeDescriptor#NULL}. */ public Class getType() { if (this.type != null) { @@ -162,14 +161,6 @@ public class TypeDescriptor { return (type != null ? ClassUtils.resolvePrimitiveIfNecessary(type) : type); } - /** - * Does the underyling declared type equal the type provided? - * @param type the type to test against - */ - public boolean typeEquals(Class type) { - return ObjectUtils.nullSafeEquals(getType(), type); - } - /** * Returns the name of this type: the fully qualified class name. */ diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToMapConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToMapConverter.java index 0d7fb4d1d2..357367fe83 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToMapConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToMapConverter.java @@ -77,7 +77,7 @@ final class CollectionToMapConverter implements ConditionalGenericConverter { } if (keysCompatible && valuesCompatible) { Map target = CollectionFactory.createMap(targetType.getType(), sourceCollection.size()); - if (sourceElementType.typeEquals(String.class)) { + if (String.class.equals(sourceElementType.getType())) { for (Object element : sourceCollection) { String[] property = parseProperty((String) element); target.put(property[0], property[1]); @@ -94,7 +94,7 @@ final class CollectionToMapConverter implements ConditionalGenericConverter { Map target = CollectionFactory.createMap(targetType.getType(), sourceCollection.size()); MapEntryConverter converter = new MapEntryConverter(sourceElementType, sourceElementType, targetKeyType, targetValueType, keysCompatible, valuesCompatible, conversionService); - if (sourceElementType.typeEquals(String.class)) { + if (String.class.equals(sourceElementType.getType())) { for (Object element : sourceCollection) { String[] property = parseProperty((String) element); Object targetKey = converter.convertKey(property[0]);