You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "James Carman (JIRA)" <ji...@apache.org> on 2008/07/09 13:35:31 UTC

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

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