[英]Java.beans.Introspector.getBeanInfo() fails to assign writeMethods
I made a super simple example that doesn't make any sense. 我做了一个超级简单的例子,没有任何意义。
public static void main(String [] args) throws IntrospectionException {
BeanInfo info = Introspector.getBeanInfo(DemandBidType.class);
int breakpoint = 0;
}
Here's my class: 这是我的课:
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;
}
}
And here is a screen shot showing the problem; 这是显示问题的屏幕快照; the field I care about isn't being recognized as having a write method. 我关心的字段未被识别为具有write方法。 I added another field 'test' and that one works fine... There was very little related to this on Google, and what was there was years old with older java versions. 我添加了另一个字段“ test”,并且该字段工作正常……在Google上与此相关的内容很少,而使用较旧的Java版本已有多年历史。 You can see in the bottom right that I'm using 1.7.51. 您可以在右下角看到我正在使用1.7.51。
( http://i.stack.imgur.com/DKC6e.png ) ( http://i.stack.imgur.com/DKC6e.png )
It turns out it's because the return type of the getter doesn't match the argument of the setter. 事实证明,这是因为getter的返回类型与setter的参数不匹配。 (One's "Boolean" the other "boolean"). (一个为“布尔值”,另一个为“布尔值”)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.