简体   繁体   English

Java.beans.Introspector.getBeanInfo()无法分配writeMethods

[英]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.

相关问题 不活动后调用java.beans.Introspector.getBeanInfo时的性能问题 - Performance issues when calling java.beans.Introspector.getBeanInfo after inactivity java.beans.Introspector getBeanInfo不会拾取任何超接口的属性 - java.beans.Introspector getBeanInfo does not pickup any superinterface's properties 泛型和java.beans.Introspector - Generics and java.beans.Introspector Java Bean Introspector需要桌面模块 - Java Beans Introspector requires desktop module 具有通用实现方法的Introspector getBeanInfo在bean上 - Introspector getBeanInfo on bean with generic implemented method 使用使用java.beans类的jar(Introspector,BeanInfo或PropertyDescriptor) - Using jars that use java.beans classes (Introspector, BeanInfo or PropertyDescriptor) Spring LibGDX And​​roid应用程序中缺少java.beans.Introspector - Missing java.beans.Introspector in Spring LibGDX Android application 使用 OpenCSV 解析 csv 文件时没有找到类“java.beans.Introspector” - Didn't find class “java.beans.Introspector” when Using OpenCSV to parse csv files Java 8和Bean Info Introspector中的接口中的默认方法 - Default method in interface in Java 8 and Bean Info Introspector 为 spring bean 分配注释 - Assign spring beans with annotations
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM