本文整理汇总了Java中java.beans.PropertyDescriptor.isExpert方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyDescriptor.isExpert方法的具体用法?Java PropertyDescriptor.isExpert怎么用?Java PropertyDescriptor.isExpert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.beans.PropertyDescriptor
的用法示例。
在下文中一共展示了PropertyDescriptor.isExpert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test
import java.beans.PropertyDescriptor; //导入方法依赖的package包/类
private static void test(Class<?> cls, boolean isBound, boolean isExpert,
boolean isHidden, boolean isPref, boolean isReq,
boolean isVS) {
PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(cls, "value");
if (pd.isBound() != isBound) {
throw new RuntimeException("isBound should be: " + isBound);
}
if (pd.isExpert() != isExpert || getValue(pd, "expert") != isExpert) {
throw new RuntimeException("isExpert should be:" + isExpert);
}
if (pd.isHidden() != isHidden || getValue(pd, "hidden") != isHidden) {
throw new RuntimeException("isHidden should be: " + isHidden);
}
if (pd.isPreferred() != isPref) {
throw new RuntimeException("isPreferred should be: " + isPref);
}
if (getValue(pd, "required") != isReq) {
throw new RuntimeException("required should be: " + isReq);
}
if (getValue(pd, "visualUpdate") != isVS) {
throw new RuntimeException("required should be: " + isVS);
}
if (pd.getValue("enumerationValues") == null) {
throw new RuntimeException("enumerationValues should be empty array");
}
}
示例2: main
import java.beans.PropertyDescriptor; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
Class<?>[] types =
{B.class, BL.class, BLF.class, E.class, H.class, P.class,
VU.class, D.class, EVD.class, EVE.class, EV.class, EVL.class,
EVX.class, R.class};
for (Class<?> type : types) {
PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(type, "value");
if (((B.class == type) || (BLF.class == type)) && pd.isBound()) {
BeanUtils.reportPropertyDescriptor(pd);
throw new Error("not bound");
}
if ((BL.class == type) == !pd.isBound()) {
BeanUtils.reportPropertyDescriptor(pd);
throw new Error("bound");
}
if ((E.class == type) == !pd.isExpert()) {
BeanUtils.reportPropertyDescriptor(pd);
throw new Error("expert");
}
if ((H.class == type) == !pd.isHidden()) {
BeanUtils.reportPropertyDescriptor(pd);
throw new Error("hidden");
}
if ((P.class == type) == !pd.isPreferred()) {
BeanUtils.reportPropertyDescriptor(pd);
throw new Error("preferred");
}
if ((R.class == type) == !Boolean.TRUE.equals(pd.getValue("required"))) {
BeanUtils.reportPropertyDescriptor(pd);
throw new Error("required");
}
if ((D.class == type) == !"getter".equals(pd.getShortDescription())) {
BeanUtils.reportPropertyDescriptor(pd);
throw new Error("shortDescription");
}
if ((VU.class == type) == !Boolean.TRUE.equals(pd.getValue("visualUpdate"))) {
BeanUtils.reportPropertyDescriptor(pd);
throw new Error("visualUpdate");
}
if ((EV.class == type) == !isEV(pd, "LEFT", 2, "javax.swing.SwingConstants.LEFT", "RIGHT", 4, "javax.swing.SwingConstants.RIGHT")) {
BeanUtils.reportPropertyDescriptor(pd);
throw new Error("enumerationValues from another package");
}
if ((EVL.class == type) == !isEV(pd, "ZERO", 0, "ZERO", "ONE", 1, "ONE")) {
BeanUtils.reportPropertyDescriptor(pd);
throw new Error("enumerationValues from another package");
}
if ((EVX.class == type) == !isEV(pd, "ZERO", 0, "X.ZERO", "ONE", 1, "X.ONE")) {
BeanUtils.reportPropertyDescriptor(pd);
throw new Error("enumerationValues from another package");
}
if (EVD.class == type && !isEV(pd)) {
BeanUtils.reportPropertyDescriptor(pd);
throw new Error("EV:"+ pd.getValue("enumerationValues"));
}
if (EVE.class == type && !isEV(pd)) {
BeanUtils.reportPropertyDescriptor(pd);
throw new Error("EV:"+ pd.getValue("enumerationValues"));
}
}
}