isCompatibleWith now takes bean type itself into account as well
This commit is contained in:
@@ -58,7 +58,7 @@ public class Bean {
|
||||
}
|
||||
|
||||
public boolean isTypeCompatibleWith(String type) {
|
||||
return supertypes.contains(type);
|
||||
return type != null && ((this.type != null && this.type.equals(type)) || (supertypes.contains(type)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -230,6 +230,7 @@ public class SpringMetamodelIndexerBeansTest {
|
||||
assertTrue(beans[0].isTypeCompatibleWith("org.test.supertypes.Interface2OfBeanWithSupertypes"));
|
||||
assertTrue(beans[0].isTypeCompatibleWith("org.test.supertypes.InterfaceOfAbstractBean"));
|
||||
assertTrue(beans[0].isTypeCompatibleWith("org.test.supertypes.BaseClassOfAbstractBeanWithSupertypes"));
|
||||
assertTrue(beans[0].isTypeCompatibleWith("org.test.BeanWithSupertypes"));
|
||||
|
||||
assertFalse(beans[0].isTypeCompatibleWith("java.lang.String"));
|
||||
assertFalse(beans[0].isTypeCompatibleWith("java.util.Comparator"));
|
||||
|
||||
Reference in New Issue
Block a user