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