commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicolas.CHALUM...@arsoe-trelaze.com
Subject [BeanUtils] Indexed and mapped properties
Date Wed, 24 Sep 2003 09:24:32 GMT
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


Mime
View raw message