commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marco Janc (Jira)" <j...@apache.org>
Subject [jira] [Created] (BEANUTILS-526) copyProperty should instantiate nested properties
Date Mon, 07 Oct 2019 11:46:00 GMT
Marco Janc created BEANUTILS-526:
------------------------------------

             Summary: copyProperty should instantiate nested properties
                 Key: BEANUTILS-526
                 URL: https://issues.apache.org/jira/browse/BEANUTILS-526
             Project: Commons BeanUtils
          Issue Type: Bug
          Components: Bean / Property Utils
    Affects Versions: 1.9.4
            Reporter: Marco Janc


The function _BeanUtils.copyProperty(bean, name, value)_ shall instantiate nested properties
before copying them.

 

*Example:*

 

 
{code:java}

{code}
*class Foo*
*{*
    *Bar bar;*
*}*

*class Bar*
*{*
    *int id;*
*}*

 

We now have an instance of _Foo_ where _bar_ property is null and call:

 
{code:java}
Foo foo = new Foo();
BeanUtils.copyProperty(foo, "bar.id", 3);
{code}
This will throw an exception currently.

 

*Workaround*

In my generic copy method, i instantiate all required nested properties before.

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message