Browse Source

polishing

pull/7/head
Juergen Hoeller 14 years ago
parent
commit
771c59f88a
  1. 23
      org.springframework.core/src/main/java/org/springframework/core/convert/TypeDescriptor.java

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

@ -295,12 +295,15 @@ public class TypeDescriptor { @@ -295,12 +295,15 @@ public class TypeDescriptor {
}
if (isArray() && typeDescriptor.isArray()) {
return getElementTypeDescriptor().isAssignableTo(typeDescriptor.getElementTypeDescriptor());
} else if (isCollection() && typeDescriptor.isCollection()) {
}
else if (isCollection() && typeDescriptor.isCollection()) {
return isNestedAssignable(getElementTypeDescriptor(), typeDescriptor.getElementTypeDescriptor());
} else if (isMap() && typeDescriptor.isMap()) {
}
else if (isMap() && typeDescriptor.isMap()) {
return isNestedAssignable(getMapKeyTypeDescriptor(), typeDescriptor.getMapKeyTypeDescriptor()) &&
isNestedAssignable(getMapValueTypeDescriptor(), typeDescriptor.getMapValueTypeDescriptor());
} else {
}
else {
return true;
}
}
@ -424,9 +427,11 @@ public class TypeDescriptor { @@ -424,9 +427,11 @@ public class TypeDescriptor {
}
if (isCollection() || isArray()) {
return ObjectUtils.nullSafeEquals(getElementTypeDescriptor(), other.getElementTypeDescriptor());
} else if (isMap()) {
}
else if (isMap()) {
return ObjectUtils.nullSafeEquals(getMapKeyTypeDescriptor(), other.getMapKeyTypeDescriptor()) && ObjectUtils.nullSafeEquals(getMapValueTypeDescriptor(), other.getMapValueTypeDescriptor());
} else {
}
else {
return true;
}
}
@ -445,7 +450,8 @@ public class TypeDescriptor { @@ -445,7 +450,8 @@ public class TypeDescriptor {
if (isMap()) {
builder.append("<").append(wildcard(getMapKeyTypeDescriptor()));
builder.append(", ").append(wildcard(getMapValueTypeDescriptor())).append(">");
} else if (isCollection()) {
}
else if (isCollection()) {
builder.append("<").append(wildcard(getElementTypeDescriptor())).append(">");
}
return builder.toString();
@ -547,7 +553,8 @@ public class TypeDescriptor { @@ -547,7 +553,8 @@ public class TypeDescriptor {
private TypeDescriptor narrow(Object value, TypeDescriptor typeDescriptor) {
if (typeDescriptor != null) {
return typeDescriptor.narrow(value);
} else {
}
else {
return value != null ? new TypeDescriptor(value.getClass(), null, null, null, annotations) : null;
}
}
@ -563,4 +570,4 @@ public class TypeDescriptor { @@ -563,4 +570,4 @@ public class TypeDescriptor {
return typeDescriptor != null ? typeDescriptor.toString() : "?";
}
}
}

Loading…
Cancel
Save