如何检测我的 bean 中的(无意的)只写属性?
我一直在使用“Drools Planner”包开发我的第一个 Java 项目,在我的类中使用 JavaBean 模式。我无意中将我的一个类编码为具有只写属性,这触发了这个错误
如果该属性是只写的,确实可能返回 null,如所解释的 在 JavaBeans(TM) 规范 1.01 最终版本中
我如何以编程方式检查我的类并查看哪个类具有违规的只写属性?
或者,由于只有 6 个类,是否有一些经验法则可以通过肉眼找到它?
I have been working on my first Java project with the 'Drools Planner' package, using the JavaBean pattern for my classes. I inadvertently coded one of my classes to have a write-only property, which triggered this bug
might indeed return null if the property is write-only, as explained
in the JavaBeans(TM) Specification 1.01 Final Release
How do I programatically check my classes and see which one has the offending write-only property?
Or, since it's a matter of just 6 classes, is there some rule of thumb to find it by eyeball?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以编程方式,您可以使用 bean 描述符来找出没有属性 getter 的类
您还可以检查 IDE 的代码完成来检查您的所有属性是否都有 getter,启动它,然后输入“get”和“is”,它将列出所有吸气剂:)
Programatically you can use the bean descriptor to figure out the classes with no getter for properties
You can also check the IDE's code completion to check whether your all properties have getters, initiate it and then type in 'get'and 'is' it will list all the getters :)