[jira] Created: (BEANUTILS-321) [beanutils] wont recognize isXXX() properties returning Boolean Object

View: New views
20 Messages — Rating Filter:   Alert me  

[jira] Created: (BEANUTILS-321) [beanutils] wont recognize isXXX() properties returning Boolean Object

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

[beanutils] wont recognize isXXX() properties returning Boolean Object
----------------------------------------------------------------------

                 Key: BEANUTILS-321
                 URL: https://issues.apache.org/jira/browse/BEANUTILS-321
             Project: Commons BeanUtils
          Issue Type: New Feature
    Affects Versions: 1.7.0
            Reporter: thomas menzel


I have a bean class "Cache" which is generated from jaxb , which has the isEnable method, i can not use the xpath expression "/cache/enable"to retrive the result, is that means BeanUtils only support setXXX getXXX? not support isXXX for boolean values?

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (BEANUTILS-321) [beanutils] wont recognize isXXX() properties returning Boolean Object

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/BEANUTILS-321?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

thomas menzel updated BEANUTILS-321:
------------------------------------

    Description:
it seems that an isXXX() style property returning an java.lang.Boolean Object is NOT recognized as the getter peoperty -- at least it wont copy it.

Hence, the test case below will fail

{code:java}
/**
 * @author tmenzel
 *
 */
public class BeanUtilsTest extends TestCase {

  private class FooBean {
    Boolean booleanClass;

    boolean booleanPrimitive;

    public Boolean isBooleanClass() {
      return booleanClass;
    }

    public void setBooleanClass(Boolean booleanClass) {
      this.booleanClass = booleanClass;
    }

    public boolean isBooleanPrimitive() {
      return booleanPrimitive;
    }

    public void setBooleanPrimitive(boolean booleanPrimitive) {
      this.booleanPrimitive = booleanPrimitive;
    }

  }

  public void testCopyBooleanProps() throws Exception {

    FooBean a = new FooBean();
    a.setBooleanClass(false);
    a.setBooleanPrimitive(false);

    FooBean b = new FooBean();
    b.setBooleanClass(true);
    b.setBooleanPrimitive(true);

    BeanUtils.copyProperties(a, b);

    assertEquals(a.isBooleanPrimitive(), b.isBooleanPrimitive());
    assertEquals(a.isBooleanClass(), b.isBooleanClass());

  }
}
{code}

  was:I have a bean class "Cache" which is generated from jaxb , which has the isEnable method, i can not use the xpath expression "/cache/enable"to retrive the result, is that means BeanUtils only support setXXX getXXX? not support isXXX for boolean values?


> [beanutils] wont recognize isXXX() properties returning Boolean Object
> ----------------------------------------------------------------------
>
>                 Key: BEANUTILS-321
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-321
>             Project: Commons BeanUtils
>          Issue Type: New Feature
>    Affects Versions: 1.7.0
>            Reporter: thomas menzel
>
> it seems that an isXXX() style property returning an java.lang.Boolean Object is NOT recognized as the getter peoperty -- at least it wont copy it.
> Hence, the test case below will fail
> {code:java}
> /**
>  * @author tmenzel
>  *
>  */
> public class BeanUtilsTest extends TestCase {
>   private class FooBean {
>     Boolean booleanClass;
>     boolean booleanPrimitive;
>     public Boolean isBooleanClass() {
>       return booleanClass;
>     }
>     public void setBooleanClass(Boolean booleanClass) {
>       this.booleanClass = booleanClass;
>     }
>     public boolean isBooleanPrimitive() {
>       return booleanPrimitive;
>     }
>     public void setBooleanPrimitive(boolean booleanPrimitive) {
>       this.booleanPrimitive = booleanPrimitive;
>     }
>   }
>   public void testCopyBooleanProps() throws Exception {
>     FooBean a = new FooBean();
>     a.setBooleanClass(false);
>     a.setBooleanPrimitive(false);
>     FooBean b = new FooBean();
>     b.setBooleanClass(true);
>     b.setBooleanPrimitive(true);
>     BeanUtils.copyProperties(a, b);
>     assertEquals(a.isBooleanPrimitive(), b.isBooleanPrimitive());
>     assertEquals(a.isBooleanClass(), b.isBooleanClass());
>   }
> }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (BEANUTILS-321) [beanutils] wont recognize isXXX() properties returning Boolean Object

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/BEANUTILS-321?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

thomas menzel updated BEANUTILS-321:
------------------------------------

    Description:
it seems that an isXXX() style property returning an java.lang.Boolean Object is NOT recognized as the getter peoperty -- at least it wont copy it.

Hence, the test case below will fail.
I suggest to handle these props as well, as for a user of BeanUtils this was/is quite surprising to me -- and probably others.

Thx

{code:java}
/**
 * @author tmenzel
 *
 */
public class BeanUtilsTest extends TestCase {

  private class FooBean {
    Boolean booleanClass;

    boolean booleanPrimitive;

    public Boolean isBooleanClass() {
      return booleanClass;
    }

    public void setBooleanClass(Boolean booleanClass) {
      this.booleanClass = booleanClass;
    }

    public boolean isBooleanPrimitive() {
      return booleanPrimitive;
    }

    public void setBooleanPrimitive(boolean booleanPrimitive) {
      this.booleanPrimitive = booleanPrimitive;
    }

  }

  public void testCopyBooleanProps() throws Exception {

    FooBean a = new FooBean();
    a.setBooleanClass(false);
    a.setBooleanPrimitive(false);

    FooBean b = new FooBean();
    b.setBooleanClass(true);
    b.setBooleanPrimitive(true);

    BeanUtils.copyProperties(a, b);

    assertEquals(a.isBooleanPrimitive(), b.isBooleanPrimitive());
    assertEquals(a.isBooleanClass(), b.isBooleanClass());

  }
}
{code}

  was:
it seems that an isXXX() style property returning an java.lang.Boolean Object is NOT recognized as the getter peoperty -- at least it wont copy it.

Hence, the test case below will fail

{code:java}
/**
 * @author tmenzel
 *
 */
public class BeanUtilsTest extends TestCase {

  private class FooBean {
    Boolean booleanClass;

    boolean booleanPrimitive;

    public Boolean isBooleanClass() {
      return booleanClass;
    }

    public void setBooleanClass(Boolean booleanClass) {
      this.booleanClass = booleanClass;
    }

    public boolean isBooleanPrimitive() {
      return booleanPrimitive;
    }

    public void setBooleanPrimitive(boolean booleanPrimitive) {
      this.booleanPrimitive = booleanPrimitive;
    }

  }

  public void testCopyBooleanProps() throws Exception {

    FooBean a = new FooBean();
    a.setBooleanClass(false);
    a.setBooleanPrimitive(false);

    FooBean b = new FooBean();
    b.setBooleanClass(true);
    b.setBooleanPrimitive(true);

    BeanUtils.copyProperties(a, b);

    assertEquals(a.isBooleanPrimitive(), b.isBooleanPrimitive());
    assertEquals(a.isBooleanClass(), b.isBooleanClass());

  }
}
{code}


> [beanutils] wont recognize isXXX() properties returning Boolean Object
> ----------------------------------------------------------------------
>
>                 Key: BEANUTILS-321
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-321
>             Project: Commons BeanUtils
>          Issue Type: New Feature
>    Affects Versions: 1.7.0
>            Reporter: thomas menzel
>
> it seems that an isXXX() style property returning an java.lang.Boolean Object is NOT recognized as the getter peoperty -- at least it wont copy it.
> Hence, the test case below will fail.
> I suggest to handle these props as well, as for a user of BeanUtils this was/is quite surprising to me -- and probably others.
> Thx
> {code:java}
> /**
>  * @author tmenzel
>  *
>  */
> public class BeanUtilsTest extends TestCase {
>   private class FooBean {
>     Boolean booleanClass;
>     boolean booleanPrimitive;
>     public Boolean isBooleanClass() {
>       return booleanClass;
>     }
>     public void setBooleanClass(Boolean booleanClass) {
>       this.booleanClass = booleanClass;
>     }
>     public boolean isBooleanPrimitive() {
>       return booleanPrimitive;
>     }
>     public void setBooleanPrimitive(boolean booleanPrimitive) {
>       this.booleanPrimitive = booleanPrimitive;
>     }
>   }
>   public void testCopyBooleanProps() throws Exception {
>     FooBean a = new FooBean();
>     a.setBooleanClass(false);
>     a.setBooleanPrimitive(false);
>     FooBean b = new FooBean();
>     b.setBooleanClass(true);
>     b.setBooleanPrimitive(true);
>     BeanUtils.copyProperties(a, b);
>     assertEquals(a.isBooleanPrimitive(), b.isBooleanPrimitive());
>     assertEquals(a.isBooleanClass(), b.isBooleanClass());
>   }
> }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (BEANUTILS-321) [beanutils] wont recognize isXXX() properties returning Boolean Object

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/BEANUTILS-321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12611990#action_12611990 ]

James Carman commented on BEANUTILS-321:
----------------------------------------

This is because the JavaBeans specification doesn't say that Boolean properties can have "is" accessor methods, only boolean properties.  See the JavaBeans specification section 8.3.2.

http://java.sun.com/javase/technologies/desktop/javabeans/docs/spec.html

> [beanutils] wont recognize isXXX() properties returning Boolean Object
> ----------------------------------------------------------------------
>
>                 Key: BEANUTILS-321
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-321
>             Project: Commons BeanUtils
>          Issue Type: New Feature
>    Affects Versions: 1.7.0
>            Reporter: thomas menzel
>
> it seems that an isXXX() style property returning an java.lang.Boolean Object is NOT recognized as the getter peoperty -- at least it wont copy it.
> Hence, the test case below will fail.
> I suggest to handle these props as well, as for a user of BeanUtils this was/is quite surprising to me -- and probably others.
> Thx
> {code:java}
> /**
>  * @author tmenzel
>  *
>  */
> public class BeanUtilsTest extends TestCase {
>   private class FooBean {
>     Boolean booleanClass;
>     boolean booleanPrimitive;
>     public Boolean isBooleanClass() {
>       return booleanClass;
>     }
>     public void setBooleanClass(Boolean booleanClass) {
>       this.booleanClass = booleanClass;
>     }
>     public boolean isBooleanPrimitive() {
>       return booleanPrimitive;
>     }
>     public void setBooleanPrimitive(boolean booleanPrimitive) {
>       this.booleanPrimitive = booleanPrimitive;
>     }
>   }
>   public void testCopyBooleanProps() throws Exception {
>     FooBean a = new FooBean();
>     a.setBooleanClass(false);
>     a.setBooleanPrimitive(false);
>     FooBean b = new FooBean();
>     b.setBooleanClass(true);
>     b.setBooleanPrimitive(true);
>     BeanUtils.copyProperties(a, b);
>     assertEquals(a.isBooleanPrimitive(), b.isBooleanPrimitive());
>     assertEquals(a.isBooleanClass(), b.isBooleanClass());
>   }
> }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (BEANUTILS-321) [beanutils] wont recognize isXXX() properties returning Boolean Object

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/BEANUTILS-321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12611997#action_12611997 ]

thomas menzel commented on BEANUTILS-321:
-----------------------------------------

Even so, I still argue that it would be more intuitive if that would be working or at least be configurable somehow.

At least this should be mentioned in the Api as well.

> [beanutils] wont recognize isXXX() properties returning Boolean Object
> ----------------------------------------------------------------------
>
>                 Key: BEANUTILS-321
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-321
>             Project: Commons BeanUtils
>          Issue Type: New Feature
>    Affects Versions: 1.7.0
>            Reporter: thomas menzel
>
> it seems that an isXXX() style property returning an java.lang.Boolean Object is NOT recognized as the getter peoperty -- at least it wont copy it.
> Hence, the test case below will fail.
> I suggest to handle these props as well, as for a user of BeanUtils this was/is quite surprising to me -- and probably others.
> Thx
> {code:java}
> /**
>  * @author tmenzel
>  *
>  */
> public class BeanUtilsTest extends TestCase {
>   private class FooBean {
>     Boolean booleanClass;
>     boolean booleanPrimitive;
>     public Boolean isBooleanClass() {
>       return booleanClass;
>     }
>     public void setBooleanClass(Boolean booleanClass) {
>       this.booleanClass = booleanClass;
>     }
>     public boolean isBooleanPrimitive() {
>       return booleanPrimitive;
>     }
>     public void setBooleanPrimitive(boolean booleanPrimitive) {
>       this.booleanPrimitive = booleanPrimitive;
>     }
>   }
>   public void testCopyBooleanProps() throws Exception {
>     FooBean a = new FooBean();
>     a.setBooleanClass(false);
>     a.setBooleanPrimitive(false);
>     FooBean b = new FooBean();
>     b.setBooleanClass(true);
>     b.setBooleanPrimitive(true);
>     BeanUtils.copyProperties(a, b);
>     assertEquals(a.isBooleanPrimitive(), b.isBooleanPrimitive());
>     assertEquals(a.isBooleanClass(), b.isBooleanClass());
>   }
> }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (BEANUTILS-321) [beanutils] wont recognize isXXX() properties returning Boolean Object

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/BEANUTILS-321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12612011#action_12612011 ]

James Carman commented on BEANUTILS-321:
----------------------------------------

How are you getting classes that have Boolean properties set up with "is" accessor methods (IDEs don't generate them that way)?  This can be dangerous, especially with autoboxing (or autounboxing rather), because if the value us null, you'll get a NPE.  If it truly is a binary sort of situation (either it is or it isn't) then you should use boolean, since Boolean is actually somewhat ternary (true, false, null).

> [beanutils] wont recognize isXXX() properties returning Boolean Object
> ----------------------------------------------------------------------
>
>                 Key: BEANUTILS-321
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-321
>             Project: Commons BeanUtils
>          Issue Type: New Feature
>    Affects Versions: 1.7.0
>            Reporter: thomas menzel
>
> it seems that an isXXX() style property returning an java.lang.Boolean Object is NOT recognized as the getter peoperty -- at least it wont copy it.
> Hence, the test case below will fail.
> I suggest to handle these props as well, as for a user of BeanUtils this was/is quite surprising to me -- and probably others.
> Thx
> {code:java}
> /**
>  * @author tmenzel
>  *
>  */
> public class BeanUtilsTest extends TestCase {
>   private class FooBean {
>     Boolean booleanClass;
>     boolean booleanPrimitive;
>     public Boolean isBooleanClass() {
>       return booleanClass;
>     }
>     public void setBooleanClass(Boolean booleanClass) {
>       this.booleanClass = booleanClass;
>     }
>     public boolean isBooleanPrimitive() {
>       return booleanPrimitive;
>     }
>     public void setBooleanPrimitive(boolean booleanPrimitive) {
>       this.booleanPrimitive = booleanPrimitive;
>     }
>   }
>   public void testCopyBooleanProps() throws Exception {
>     FooBean a = new FooBean();
>     a.setBooleanClass(false);
>     a.setBooleanPrimitive(false);
>     FooBean b = new FooBean();
>     b.setBooleanClass(true);
>     b.setBooleanPrimitive(true);
>     BeanUtils.copyProperties(a, b);
>     assertEquals(a.isBooleanPrimitive(), b.isBooleanPrimitive());
>     assertEquals(a.isBooleanClass(), b.isBooleanClass());
>   }
> }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (BEANUTILS-321) [beanutils] wont recognize isXXX() properties returning Boolean Object

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/BEANUTILS-321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12612015#action_12612015 ]

James Carman commented on BEANUTILS-321:
----------------------------------------

By the way, this is mentioned in the API documentation (albeit in a somewhat roundabout way).  The BeanUtils class uses a PropertyUtilsBean:

http://commons.apache.org/beanutils/commons-beanutils-1.7.0/docs/api/org/apache/commons/beanutils/PropertyUtilsBean.html

"The name of the actual getter or setter method to be used is determined using standard JavaBeans instrospection, so that (unless overridden by a BeanInfo class, a property named "xyz" will have a getter method named getXyz() or (*for boolean properties only*) isXyz(), and a setter method named setXyz()."

> [beanutils] wont recognize isXXX() properties returning Boolean Object
> ----------------------------------------------------------------------
>
>                 Key: BEANUTILS-321
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-321
>             Project: Commons BeanUtils
>          Issue Type: New Feature
>    Affects Versions: 1.7.0
>            Reporter: thomas menzel
>
> it seems that an isXXX() style property returning an java.lang.Boolean Object is NOT recognized as the getter peoperty -- at least it wont copy it.
> Hence, the test case below will fail.
> I suggest to handle these props as well, as for a user of BeanUtils this was/is quite surprising to me -- and probably others.
> Thx
> {code:java}
> /**
>  * @author tmenzel
>  *
>  */
> public class BeanUtilsTest extends TestCase {
>   private class FooBean {
>     Boolean booleanClass;
>     boolean booleanPrimitive;
>     public Boolean isBooleanClass() {
>       return booleanClass;
>     }
>     public void setBooleanClass(Boolean booleanClass) {
>       this.booleanClass = booleanClass;
>     }
>     public boolean isBooleanPrimitive() {
>       return booleanPrimitive;
>     }
>     public void setBooleanPrimitive(boolean booleanPrimitive) {
>       this.booleanPrimitive = booleanPrimitive;
>     }
>   }
>   public void testCopyBooleanProps() throws Exception {
>     FooBean a = new FooBean();
>     a.setBooleanClass(false);
>     a.setBooleanPrimitive(false);
>     FooBean b = new FooBean();
>     b.setBooleanClass(true);
>     b.setBooleanPrimitive(true);
>     BeanUtils.copyProperties(a, b);
>     assertEquals(a.isBooleanPrimitive(), b.isBooleanPrimitive());
>     assertEquals(a.isBooleanClass(), b.isBooleanClass());
>   }
> }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (BEANUTILS-321) [beanutils] wont recognize isXXX() properties returning Boolean Object

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/BEANUTILS-321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12612017#action_12612017 ]

Paul Benedict commented on BEANUTILS-321:
-----------------------------------------

I think a Boolean object should be treated like a boolean type.

> [beanutils] wont recognize isXXX() properties returning Boolean Object
> ----------------------------------------------------------------------
>
>                 Key: BEANUTILS-321
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-321
>             Project: Commons BeanUtils
>          Issue Type: New Feature
>    Affects Versions: 1.7.0
>            Reporter: thomas menzel
>
> it seems that an isXXX() style property returning an java.lang.Boolean Object is NOT recognized as the getter peoperty -- at least it wont copy it.
> Hence, the test case below will fail.
> I suggest to handle these props as well, as for a user of BeanUtils this was/is quite surprising to me -- and probably others.
> Thx
> {code:java}
> /**
>  * @author tmenzel
>  *
>  */
> public class BeanUtilsTest extends TestCase {
>   private class FooBean {
>     Boolean booleanClass;
>     boolean booleanPrimitive;
>     public Boolean isBooleanClass() {
>       return booleanClass;
>     }
>     public void setBooleanClass(Boolean booleanClass) {
>       this.booleanClass = booleanClass;
>     }
>     public boolean isBooleanPrimitive() {
>       return booleanPrimitive;
>     }
>     public void setBooleanPrimitive(boolean booleanPrimitive) {
>       this.booleanPrimitive = booleanPrimitive;
>     }
>   }
>   public void testCopyBooleanProps() throws Exception {
>     FooBean a = new FooBean();
>     a.setBooleanClass(false);
>     a.setBooleanPrimitive(false);
>     FooBean b = new FooBean();
>     b.setBooleanClass(true);
>     b.setBooleanPrimitive(true);
>     BeanUtils.copyProperties(a, b);
>     assertEquals(a.isBooleanPrimitive(), b.isBooleanPrimitive());
>     assertEquals(a.isBooleanClass(), b.isBooleanClass());
>   }
> }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (BEANUTILS-321) [beanutils] wont recognize isXXX() properties returning Boolean Object

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/BEANUTILS-321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12612017#action_12612017 ]

paul4christ79 edited comment on BEANUTILS-321 at 7/9/08 5:08 AM:
-----------------------------------------------------------------

I don't think a Boolean object should be treated like a boolean type. It's not a true/false statement to have three states. In this situation, the property should throw an exception if the underlying property is null or interpret null as false -- but also provide a different property that does get/set with a Boolean object.

      was (Author: paul4christ79):
    I think a Boolean object should be treated like a boolean type.
 

> [beanutils] wont recognize isXXX() properties returning Boolean Object
> ----------------------------------------------------------------------
>
>                 Key: BEANUTILS-321
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-321
>             Project: Commons BeanUtils
>          Issue Type: New Feature
>    Affects Versions: 1.7.0
>            Reporter: thomas menzel
>
> it seems that an isXXX() style property returning an java.lang.Boolean Object is NOT recognized as the getter peoperty -- at least it wont copy it.
> Hence, the test case below will fail.
> I suggest to handle these props as well, as for a user of BeanUtils this was/is quite surprising to me -- and probably others.
> Thx
> {code:java}
> /**
>  * @author tmenzel
>  *
>  */
> public class BeanUtilsTest extends TestCase {
>   private class FooBean {
>     Boolean booleanClass;
>     boolean booleanPrimitive;
>     public Boolean isBooleanClass() {
>       return booleanClass;
>     }
>     public void setBooleanClass(Boolean booleanClass) {
>       this.booleanClass = booleanClass;
>     }
>     public boolean isBooleanPrimitive() {
>       return booleanPrimitive;
>     }
>     public void setBooleanPrimitive(boolean booleanPrimitive) {
>       this.booleanPrimitive = booleanPrimitive;
>     }
>   }
>   public void testCopyBooleanProps() throws Exception {
>     FooBean a = new FooBean();
>     a.setBooleanClass(false);
>     a.setBooleanPrimitive(false);
>     FooBean b = new FooBean();
>     b.setBooleanClass(true);
>     b.setBooleanPrimitive(true);
>     BeanUtils.copyProperties(a, b);
>     assertEquals(a.isBooleanPrimitive(), b.isBooleanPrimitive());
>     assertEquals(a.isBooleanClass(), b.isBooleanClass());
>   }
> }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (BEANUTILS-321) [beanutils] wont recognize isXXX() properties returning Boolean Object

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/BEANUTILS-321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12612021#action_12612021 ]

thomas menzel commented on BEANUTILS-321:
-----------------------------------------

> how to get those classes
case a) JAXB
case b) a class persisted to Hibernate where the state of null is also valid and needs to be reacted upon accordingly

> NPE
why would i get one of those when just copying the property ?
because of converters?
afer all i expect smth. like this to be performed: {{a.isBooleanClass(  b.isBooleanClass() ) }}

> Java doc
i had read that somewhere along trying to find the problem but it didnt click that this meant "native boolean".
u see, with autoboxing I dont care anymore or only a little about native or not...



> [beanutils] wont recognize isXXX() properties returning Boolean Object
> ----------------------------------------------------------------------
>
>                 Key: BEANUTILS-321
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-321
>             Project: Commons BeanUtils
>          Issue Type: New Feature
>    Affects Versions: 1.7.0
>            Reporter: thomas menzel
>
> it seems that an isXXX() style property returning an java.lang.Boolean Object is NOT recognized as the getter peoperty -- at least it wont copy it.
> Hence, the test case below will fail.
> I suggest to handle these props as well, as for a user of BeanUtils this was/is quite surprising to me -- and probably others.
> Thx
> {code:java}
> /**
>  * @author tmenzel
>  *
>  */
> public class BeanUtilsTest extends TestCase {
>   private class FooBean {
>     Boolean booleanClass;
>     boolean booleanPrimitive;
>     public Boolean isBooleanClass() {
>       return booleanClass;
>     }
>     public void setBooleanClass(Boolean booleanClass) {
>       this.booleanClass = booleanClass;
>     }
>     public boolean isBooleanPrimitive() {
>       return booleanPrimitive;
>     }
>     public void setBooleanPrimitive(boolean booleanPrimitive) {
>       this.booleanPrimitive = booleanPrimitive;
>     }
>   }
>   public void testCopyBooleanProps() throws Exception {
>     FooBean a = new FooBean();
>     a.setBooleanClass(false);
>     a.setBooleanPrimitive(false);
>     FooBean b = new FooBean();
>     b.setBooleanClass(true);
>     b.setBooleanPrimitive(true);
>     BeanUtils.copyProperties(a, b);
>     assertEquals(a.isBooleanPrimitive(), b.isBooleanPrimitive());
>     assertEquals(a.isBooleanClass(), b.isBooleanClass());
>   }
> }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (BEANUTILS-321) [beanutils] wont recognize isXXX() properties returning Boolean Object

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/BEANUTILS-321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12612021#action_12612021 ]

elonderin edited comment on BEANUTILS-321 at 7/9/08 5:12 AM:
-----------------------------------------------------------------

> how to get those classes
case a) JAXB
case b) a class persisted to Hibernate where the state of null is also valid and needs to be reacted upon accordingly

> NPE
why would i get one of those when just copying the property ?
because of converters?
afer all i expect smth. like this to be performed: a.isBooleanClass(  b.isBooleanClass() )

> Java doc
i had read that somewhere along trying to find the problem but it didnt click that this meant "native boolean".
u see, with autoboxing I dont care anymore or only a little about native or not...



      was (Author: elonderin):
    > how to get those classes
case a) JAXB
case b) a class persisted to Hibernate where the state of null is also valid and needs to be reacted upon accordingly

> NPE
why would i get one of those when just copying the property ?
because of converters?
afer all i expect smth. like this to be performed: {{a.isBooleanClass(  b.isBooleanClass() ) }}

> Java doc
i had read that somewhere along trying to find the problem but it didnt click that this meant "native boolean".
u see, with autoboxing I dont care anymore or only a little about native or not...


 

> [beanutils] wont recognize isXXX() properties returning Boolean Object
> ----------------------------------------------------------------------
>
>                 Key: BEANUTILS-321
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-321
>             Project: Commons BeanUtils
>          Issue Type: New Feature
>    Affects Versions: 1.7.0
>            Reporter: thomas menzel
>
> it seems that an isXXX() style property returning an java.lang.Boolean Object is NOT recognized as the getter peoperty -- at least it wont copy it.
> Hence, the test case below will fail.
> I suggest to handle these props as well, as for a user of BeanUtils this was/is quite surprising to me -- and probably others.
> Thx
> {code:java}
> /**
>  * @author tmenzel
>  *
>  */
> public class BeanUtilsTest extends TestCase {
>   private class FooBean {
>     Boolean booleanClass;
>     boolean booleanPrimitive;
>     public Boolean isBooleanClass() {
>       return booleanClass;
>     }
>     public void setBooleanClass(Boolean booleanClass) {
>       this.booleanClass = booleanClass;
>     }
>     public boolean isBooleanPrimitive() {
>       return booleanPrimitive;
>     }
>     public void setBooleanPrimitive(boolean booleanPrimitive) {
>       this.booleanPrimitive = booleanPrimitive;
>     }
>   }
>   public void testCopyBooleanProps() throws Exception {
>     FooBean a = new FooBean();
>     a.setBooleanClass(false);
>     a.setBooleanPrimitive(false);
>     FooBean b = new FooBean();
>     b.setBooleanClass(true);
>     b.setBooleanPrimitive(true);
>     BeanUtils.copyProperties(a, b);
>     assertEquals(a.isBooleanPrimitive(), b.isBooleanPrimitive());
>     assertEquals(a.isBooleanClass(), b.isBooleanClass());
>   }
> }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (BEANUTILS-321) [beanutils] wont recognize isXXX() properties returning Boolean Object

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/BEANUTILS-321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12612021#action_12612021 ]

elonderin edited comment on BEANUTILS-321 at 7/9/08 5:13 AM:
-----------------------------------------------------------------

> how to get those classes
case a) JAXB
case b) a class persisted to Hibernate where the state of null is also valid and needs to be reacted upon accordingly

> NPE
why would i get one of those when just copying the property ?
because of converters?
afer all i expect smth. like this to be performed: a.setBooleanClass(  b.isBooleanClass() )

> Java doc
i had read that somewhere along trying to find the problem but it didnt click that this meant "native boolean".
u see, with autoboxing I dont care anymore or only a little about native or not...



      was (Author: elonderin):
    > how to get those classes
case a) JAXB
case b) a class persisted to Hibernate where the state of null is also valid and needs to be reacted upon accordingly

> NPE
why would i get one of those when just copying the property ?
because of converters?
afer all i expect smth. like this to be performed: a.isBooleanClass(  b.isBooleanClass() )

> Java doc
i had read that somewhere along trying to find the problem but it didnt click that this meant "native boolean".
u see, with autoboxing I dont care anymore or only a little about native or not...


 

> [beanutils] wont recognize isXXX() properties returning Boolean Object
> ----------------------------------------------------------------------
>
>                 Key: BEANUTILS-321
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-321
>             Project: Commons BeanUtils
>          Issue Type: New Feature
>    Affects Versions: 1.7.0
>            Reporter: thomas menzel
>
> it seems that an isXXX() style property returning an java.lang.Boolean Object is NOT recognized as the getter peoperty -- at least it wont copy it.
> Hence, the test case below will fail.
> I suggest to handle these props as well, as for a user of BeanUtils this was/is quite surprising to me -- and probably others.
> Thx
> {code:java}
> /**
>  * @author tmenzel
>  *
>  */
> public class BeanUtilsTest extends TestCase {
>   private class FooBean {
>     Boolean booleanClass;
>     boolean booleanPrimitive;
>     public Boolean isBooleanClass() {
>       return booleanClass;
>     }
>     public void setBooleanClass(Boolean booleanClass) {
>       this.booleanClass = booleanClass;
>     }
>     public boolean isBooleanPrimitive() {
>       return booleanPrimitive;
>     }
>     public void setBooleanPrimitive(boolean booleanPrimitive) {
>       this.booleanPrimitive = booleanPrimitive;
>     }
>   }
>   public void testCopyBooleanProps() throws Exception {
>     FooBean a = new FooBean();
>     a.setBooleanClass(false);
>     a.setBooleanPrimitive(false);
>     FooBean b = new FooBean();
>     b.setBooleanClass(true);
>     b.setBooleanPrimitive(true);
>     BeanUtils.copyProperties(a, b);
>     assertEquals(a.isBooleanPrimitive(), b.isBooleanPrimitive());
>     assertEquals(a.isBooleanClass(), b.isBooleanClass());
>   }
> }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (BEANUTILS-321) [beanutils] wont recognize isXXX() properties returning Boolean Object

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/BEANUTILS-321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12612025#action_12612025 ]

thomas menzel commented on BEANUTILS-321:
-----------------------------------------

from a design point of view the isXXX() style of naming a boolean property just is a reflection on the engl. language which is more natural when using isXXX() to get the value.
in that context i dont reflect if the Type returned is actually is boolean or Boolean.

the Bean spec apparently states smth. diff or doesnt really take the Boolean case into consideration, maybe  i should post it there somewhere as i understand that it might no be a good idea to impl. this issue in a BeanUtils class that adheres to the spec.

for a developer that needs to just copy properties which follow not strictly the bean convention this is confusing.

i hope u get my point but maybe there are others that want to voice an opinion too...

> [beanutils] wont recognize isXXX() properties returning Boolean Object
> ----------------------------------------------------------------------
>
>                 Key: BEANUTILS-321
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-321
>             Project: Commons BeanUtils
>          Issue Type: New Feature
>    Affects Versions: 1.7.0
>            Reporter: thomas menzel
>
> it seems that an isXXX() style property returning an java.lang.Boolean Object is NOT recognized as the getter peoperty -- at least it wont copy it.
> Hence, the test case below will fail.
> I suggest to handle these props as well, as for a user of BeanUtils this was/is quite surprising to me -- and probably others.
> Thx
> {code:java}
> /**
>  * @author tmenzel
>  *
>  */
> public class BeanUtilsTest extends TestCase {
>   private class FooBean {
>     Boolean booleanClass;
>     boolean booleanPrimitive;
>     public Boolean isBooleanClass() {
>       return booleanClass;
>     }
>     public void setBooleanClass(Boolean booleanClass) {
>       this.booleanClass = booleanClass;
>     }
>     public boolean isBooleanPrimitive() {
>       return booleanPrimitive;
>     }
>     public void setBooleanPrimitive(boolean booleanPrimitive) {
>       this.booleanPrimitive = booleanPrimitive;
>     }
>   }
>   public void testCopyBooleanProps() throws Exception {
>     FooBean a = new FooBean();
>     a.setBooleanClass(false);
>     a.setBooleanPrimitive(false);
>     FooBean b = new FooBean();
>     b.setBooleanClass(true);
>     b.setBooleanPrimitive(true);
>     BeanUtils.copyProperties(a, b);
>     assertEquals(a.isBooleanPrimitive(), b.isBooleanPrimitive());
>     assertEquals(a.isBooleanClass(), b.isBooleanClass());
>   }
> }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (BEANUTILS-321) [beanutils] wont recognize isXXX() properties returning Boolean Object

by JIRA jira@apache.org :: Rate this Message: