smayemba wrote:
public class MyPojo {
//all private variables here
Set foo = new HashSet();
//all the puiblic get/set methods here
}
public class MyDTO {
//all private variables here
Object foo[];
//all the puiblic get/set methods here
}
BeanUtils doesn't know how to copy a set into an array, so your code needs to do that. One simple way would be to add a getter for 'foo' that returns an array, then tell BeanUtils to use that getter instead of the getter that returns the Set (perhaps rename the getter in MyPojo that returns the set).
But... if you have lots of Pojos and TOs, then you might want to make a factory that knows how to convert Pojos into TOs.