removed unused method; polishing
This commit is contained in:
parent
753d0b0c91
commit
541cf2de80
|
@ -26,7 +26,6 @@ import org.springframework.core.GenericCollectionTypeResolver;
|
||||||
import org.springframework.core.MethodParameter;
|
import org.springframework.core.MethodParameter;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.ClassUtils;
|
import org.springframework.util.ClassUtils;
|
||||||
import org.springframework.util.ObjectUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Context about a type to convert to.
|
* 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.
|
* 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() {
|
public Class<?> getType() {
|
||||||
if (this.type != null) {
|
if (this.type != null) {
|
||||||
|
@ -162,14 +161,6 @@ public class TypeDescriptor {
|
||||||
return (type != null ? ClassUtils.resolvePrimitiveIfNecessary(type) : type);
|
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.
|
* Returns the name of this type: the fully qualified class name.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -77,7 +77,7 @@ final class CollectionToMapConverter implements ConditionalGenericConverter {
|
||||||
}
|
}
|
||||||
if (keysCompatible && valuesCompatible) {
|
if (keysCompatible && valuesCompatible) {
|
||||||
Map target = CollectionFactory.createMap(targetType.getType(), sourceCollection.size());
|
Map target = CollectionFactory.createMap(targetType.getType(), sourceCollection.size());
|
||||||
if (sourceElementType.typeEquals(String.class)) {
|
if (String.class.equals(sourceElementType.getType())) {
|
||||||
for (Object element : sourceCollection) {
|
for (Object element : sourceCollection) {
|
||||||
String[] property = parseProperty((String) element);
|
String[] property = parseProperty((String) element);
|
||||||
target.put(property[0], property[1]);
|
target.put(property[0], property[1]);
|
||||||
|
@ -94,7 +94,7 @@ final class CollectionToMapConverter implements ConditionalGenericConverter {
|
||||||
Map target = CollectionFactory.createMap(targetType.getType(), sourceCollection.size());
|
Map target = CollectionFactory.createMap(targetType.getType(), sourceCollection.size());
|
||||||
MapEntryConverter converter = new MapEntryConverter(sourceElementType, sourceElementType, targetKeyType,
|
MapEntryConverter converter = new MapEntryConverter(sourceElementType, sourceElementType, targetKeyType,
|
||||||
targetValueType, keysCompatible, valuesCompatible, conversionService);
|
targetValueType, keysCompatible, valuesCompatible, conversionService);
|
||||||
if (sourceElementType.typeEquals(String.class)) {
|
if (String.class.equals(sourceElementType.getType())) {
|
||||||
for (Object element : sourceCollection) {
|
for (Object element : sourceCollection) {
|
||||||
String[] property = parseProperty((String) element);
|
String[] property = parseProperty((String) element);
|
||||||
Object targetKey = converter.convertKey(property[0]);
|
Object targetKey = converter.convertKey(property[0]);
|
||||||
|
|
Loading…
Reference in New Issue