![](/img/trans.png)
[英]Performance issues when calling java.beans.Introspector.getBeanInfo after inactivity
[英]Java.beans.Introspector.getBeanInfo() fails to assign writeMethods
我做了一個超級簡單的例子,沒有任何意義。
public static void main(String [] args) throws IntrospectionException {
BeanInfo info = Introspector.getBeanInfo(DemandBidType.class);
int breakpoint = 0;
}
這是我的課:
public class DemandBidType {
protected Boolean isDuplicateHour;
protected Boolean test;
public boolean isIsDuplicateHour() {
return isDuplicateHour;
}
public void setIsDuplicateHour(Boolean isDuplicateHour) {
this.isDuplicateHour = isDuplicateHour;
}
public Boolean getTest() {
return test;
}
public void setTest(Boolean test) {
this.test = test;
}
}
這是顯示問題的屏幕快照; 我關心的字段未被識別為具有write方法。 我添加了另一個字段“ test”,並且該字段工作正常……在Google上與此相關的內容很少,而使用較舊的Java版本已有多年歷史。 您可以在右下角看到我正在使用1.7.51。
事實證明,這是因為getter的返回類型與setter的參數不匹配。 (一個為“布爾值”,另一個為“布爾值”)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.