commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "thomas menzel (JIRA)" <j...@apache.org>
Subject [jira] Commented: (BEANUTILS-321) [beanutils] wont recognize isXXX() properties returning Boolean Object
Date Wed, 09 Jul 2008 12:29:31 GMT

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


Mime
View raw message