publicclass Test4619536 { publicstaticvoid main(String[] args) throws Exception {
IndexedPropertyDescriptor ipd = BeanUtils.getIndexedPropertyDescriptor(A.class, "foo"); if (!ipd.getIndexedPropertyType().equals(String.class)) {
error(ipd, "A.foo should be String type");
}
PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(B.class, "foo"); if (pd instanceof IndexedPropertyDescriptor) {
error(pd, "B.foo should not be an indexed property");
} if (!pd.getPropertyType().equals(Date.class)) {
error(pd, "B.foo should be Date type");
}
pd = BeanUtils.findPropertyDescriptor(Child.class, "foo"); if (pd instanceof IndexedPropertyDescriptor) {
error(pd, "Child.foo should not be an indexed property");
}
pd = BeanUtils.findPropertyDescriptor(Classic.class, "foo"); if (pd instanceof IndexedPropertyDescriptor) {
error(pd, "Classic.foo should not be an indexed property");
}
ipd = BeanUtils.getIndexedPropertyDescriptor(Index.class, "foo"); if (!hasIPD(ipd)) {
error(pd, "Index.foo should have ipd values");
} if (hasPD(ipd)) {
error(ipd, "Index.foo should not have pd values");
}
ipd = BeanUtils.getIndexedPropertyDescriptor(All.class, "foo"); if (!hasPD(ipd) || !hasIPD(ipd)) {
error(ipd, "All.foo should have all pd/ipd values");
} if (!isValidType(ipd)) {
error(ipd, "All.foo pdType should equal ipdType");
}
ipd = BeanUtils.getIndexedPropertyDescriptor(Getter.class, "foo"); if (ipd.getReadMethod() == null || ipd.getWriteMethod() != null) {
error(ipd, "Getter.foo classic methods incorrect");
} if (!isValidType(ipd)) {
error(ipd, "Getter.foo pdType should equal ipdType");
}
ipd = BeanUtils.getIndexedPropertyDescriptor(BadGetter.class, "foo"); if (hasPD(ipd)) {
error(ipd, "BadGetter.foo should not have classic methods");
}
ipd = BeanUtils.getIndexedPropertyDescriptor(Setter.class, "foo"); if (ipd.getReadMethod() != null || ipd.getWriteMethod() == null) {
error(ipd, "Setter.foo classic methods incorrect");
} if (!isValidType(ipd)) {
error(ipd, "Setter.foo pdType should equal ipdType");
}
ipd = BeanUtils.getIndexedPropertyDescriptor(BadSetter.class, "foo"); if (hasPD(ipd)) {
error(ipd, "BadSetter.foo should not have classic methods");
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.