You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by chamal desilva <ch...@yahoo.com> on 2006/08/03 11:06:50 UTC

BeanUtils copyProperties - copying vector

Hi,

I have four classes.

public class AccountForm
{
  private String accNum;
}

public class Account
{
  private String accNum;
}

public class CustomerForm
{
     private String custRef = "";
     private Vector accounts= null;//Contains objects
of AccountForms classes

     //Get, set methods
}

public class Customer
{
     private String custRef = "";
     private Vector accounts = null; //Contains
objects of Account classes

     //Get, set methods
}

Now I need to copy properties from CustomerForm object
to Customer object.

My customers classes accounts vector contains Account
objects. CustomerForm classes accounts vector contains
AccountForms.

So when BeanUtils copy accounts vector from
CustomerForm to Customer class, will it also convert
AccountForms to Accounts. If not is there a way that I
can do that.

Thanking You,
Chamal.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: BeanUtils copyProperties - copying vector

Posted by Antonio Petrelli <br...@tariffenet.it>.
chamal desilva ha scritto:
> Now I need to copy properties from CustomerForm object
> to Customer object.
>
> My customers classes accounts vector contains Account
> objects. CustomerForm classes accounts vector contains
> AccountForms.
>
> So when BeanUtils copy accounts vector from
> CustomerForm to Customer class, will it also convert
> AccountForms to Accounts. If not is there a way that I
> can do that.
>   

No you can't, you have to copy each element of the vector.

Ciao
Antonio


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