boolean1, read: public boolean javabean.BeanWithState.isBoolean1(), write: public void
javabean.BeanWithState.setBoolean1(boolean)
boolean2, read: null, write: public void
javabean.BeanWithState.setBoolean2(java.lang.Boolean)
I ran into this testing the jca managed objects. The isX form of a getter is not
considered for java.lang.Boolean properties, only the primitive boolean type. This
apparently is from the javabeans spec (which is old):
"javabeans 1.0.1" wrote :
| 8.3.2 Boolean properties
| In addition, for boolean properties, we allow a getter method to match the pattern:
| public boolean is();
| This ?is? method may be provided instead of a ?get? method, or it may be provided in
addition to a ?get? method.
| In either case, if the ?is? method is present for a boolean property then we will use
the ?is? method to read the property value.
| An example boolean property might be:
| public boolean isMarsupial();
| public void setMarsupial(boolean m);
|
With autoboxing it seems like java.lang.Boolean should also be treated this way as I can
use a primitive field without having to explicitly convert it to a Boolean:
| class Bean
| {
| boolean marsupial;
| public Boolean isMarsupial();
| public void setMarsupial(Boolean m);
| }
|
| // user code
| boolean flag = bean.isMarsupial();
|
We are explicitly disallowing the isX getter to be found for a java.lang.Boolean property
in AbstractBeanInfoFactory. Was there a problem with allowing this?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4079731#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...