commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From __matthewHawthorne <>
Subject Re: BeanUtils Feature
Date Mon, 26 Jan 2004 01:57:49 GMT
Anon Myous wrote:
 > So what I am looking for from a API standpoint
 > something equivalent to BeanUtils.copyProperty(Object
 > dest, Object orig, List propertyList)
 > where propertyList is a list of properties of the orig
 > Bean that needs to be copied to the dest Bean.

Sorry, I think I may have misunderstood the situation.  I don't think 
that there is a built-in way to do this right now.

One solution is to manually loop though your list of properties and set 
then one-by-one.  Like this:

for prop in bean1Props {
   BeanUtils.copyProperty(newBean, prop, bean1)

for prop in bean2Props {
   BeanUtils.copyProperty(newBean, prop, bean2)

Your desire for a method such as:

BeanUtils.copyProperties(Object dest, Object orig, List propertyList)

Seems valid to me, as I've recently needed the same thing.  I've never 
worked on [beanutils], so I'm not really sure what the stance on such a 
method would be... Robert, any thoughts?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message