You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Laurent PETIT <lp...@sqli.com> on 2003/07/25 17:59:23 UTC

[BeanUtils] is it possible to copy a whole graph of objects ?

Hello,

I'm wandering for hours around this question : is it possible to copy a
graph of objects with a single call from a JavaBean to a DynaBean ?

Say the DynaBean has the DynaProperties for :
String name;
app.Article[] article;

- Is there a way to define getter and setters in a JavaBean, in order to
have the BeanUtils.copyProperties() or PropertyUtils.copyProperties() to
automatically fetch the list of articles in the JavaBean and autopopulating
the DynaBean ?
- maybe the solution is not one of the two methods mentioned above but
another one I missed ?

I have tried to create getters and setters on my JavaBean as:
public Article getArticle(int index);
public void setArticle(int index, Article article);

but of course it is not sufficient, since there is no way for the BeanUtils
to know the size of the underlying article list/array in my JavaBean.

Thanks in advance,


--
Laurent PETIT [SQLI - Lyon] - lpetit@sqli.com

Groupe SQLI - www.sqli.com