commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: BeanUtils.copyProperties and ConvertUtils
Date Fri, 17 Jan 2003 05:02:55 GMT


On Thu, 16 Jan 2003, Raible, Matt wrote:

> Date: Thu, 16 Jan 2003 13:30:17 -0700
> From: "Raible, Matt" <Matt_Raible@cable.comcast.com>
> Reply-To: Jakarta Commons Users List <commons-user@jakarta.apache.org>
> To: 'Jakarta Commons Users List' <commons-user@jakarta.apache.org>
> Subject: BeanUtils.copyProperties and ConvertUtils
>
> I am using BeanUtils.copyProperties to copy a POJO to a Struts Action Form.
> The POJO has a number of List properties for children of the object.  I am
> able to copy all properties successfully from the POJO to the ActionForm
> where there are ArrayList properties for the children.  I am doing this
> using ConvertUtils and my own ListConverter.  You can find the code for my
> convert method in my ListConverter at http://tinyurl.com/4j4g if you're
> interested.
>
> Like I said, everything was working fine, until I added indexed properties
> into the mix today.  Now none of my lists are copied using
> BeanUtils.copyProperties().
>
> I have getPropertyList() and setPropertyList(ArrayList) on my form.  I also
> have getPropertyList(int index) and setPropertyList(int index, ArrayList).
>
> If I remove these "indexed" getter/setters - everything works as expected.
>

The JavaBeans spec defines indexed getters and putters only for things
that pass and return arrays, not Lists.  Therefore, this isn't going to
get recognized as a property by the standard introspector.

Commons-beanutils tries to extend the model so that you can use List-based
properties like this, but looks like it doesn't cover this particular use
case.  Could you please post a bug with a small example that illustrates
it?

  http://nagoya.apache.org/bugzilla/

> Any ideas?
>
> Thanks,
>
> Matt
>

Craig



Mime
View raw message