commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karr, David" <David.K...@wamu.net>
Subject RE: [BeanUtils] Indexed and mapped properties
Date Fri, 26 Sep 2003 18:29:19 GMT
You're trying to make the same property be both a normal and indexed
property.  You have to have only one setter and one getter for each
property.

> -----Original Message-----
> From: Nicolas.CHALUMEAU@arsoe-trelaze.com 
> [mailto:Nicolas.CHALUMEAU@arsoe-trelaze.com] 
> Sent: Wednesday, September 24, 2003 2:25 AM
> To: Jakarta Commons Users List
> Subject: [BeanUtils] Indexed and mapped properties
> 
> 
> I define a propertie with its getter and setter indexed in 
> ObjectA and 
> ObjectB :
> 
>     private Collection voConfList = new ArrayList();
>     public Collection getVoConfList() {
>         return (voConfList);
>     }
> 
>     public String getVoConfList(int index) {
>         return (String) CollectionUtils.index(voConfList, index);
>     }
> 
>     public void setVoConfList(int index, String value) {
>         // index ingnore it's just a test
>         this.voConfList.add(value);
>     }
> 
>     public void setVoConfList(Collection voConfList) {
>         this.voConfList = voConfList;
>     }
> 
> And then call copyProperties :
> objectB.setVoConfList(0, "value from")
> BeanUtils.copyProperties(objectA, objectB);
> 
> The attribut in object is create but empty. The copy is not 
> done. I have 
> the same probleme with Map. But when i do same indexed getter 
> and setter 
> for an String[] it work.
> 
> I see in the BeanUtils javadoc for copyProperties methode :
> "FIXME - Indexed and mapped properties that do not have 
> getter and setter 
> methods for the underlying array or Map are not copied by this method"
> I define getter and setter so where is the probleme
> 
> Is there an other way to copy  Indexed and mapped properties 
> of an object to an other ?
> 
> Nicolas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message