3 Replies Latest reply on Aug 31, 2007 11:13 AM by starksm64

    JBMICROCONT-204, isX getter

    starksm64


      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<PropertyName>();
      This ?is<PropertyName>? method may be provided instead of a ?get<PropertyName>? method, or it may be provided in addition to a ?get<PropertyName>? method.
      In either case, if the ?is<PropertyName>? method is present for a boolean property then we will use the ?is<PropertyName>? 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?