You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Robert Bowen <sy...@yahoo.com> on 2004/08/18 14:28:48 UTC
Whoops. Let's try that again -- copyProperties smart enough to copy to sub-objects?
Many thanks to those who responded to my post
yesterday (Craig McClanahan, Marco Mistroni), I think
I am up and running with BeanUtils.copyProperties().
I had another question though, one I am almost sure to
which the answer will be "no".
Given the following -- An object, OuterObject, which
represents table1 in the database, and a getter() and
setter() in OuterObject for InnerObject (another
table), like this:
class OuterObject {
private String ooField1;
private InnerObject obj2;
public void setOOField1(String ooField1);
public String getOOField1();
public void setInnerObject(InnerObject io);
public InnerObject getInnerObject();
}
class InnerObject {
private String iofield1;
public void setIOField1(String ioField1);
public String getIOField1();
}
... and an ActionForm with 2 fields, ooField1 and
ioField1.
The question: when I submit this form and call
copyProperties, is there a way to tell it to copy
iofield1 to the InnerObject? In other words, to call
getInnerObject().setIOField1()?
... Seems complicated. But I have a bunch of
ActionsForms which encapsulate more than 1 Java class
/ database table, and I hope I don't have to do all
that copying by hand!
Many thanx in advance!
syg
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org