|
hello,
i developed a form generator and i want to
save the user input in a xml document using castor. Once the form can be
generated dynamically by the user, each form as it's own fields created by the
user.
I know that for using castor we must have a class
with all the setters/getters so we can
insert/get data to/from a xml document. I'm trying to create just one
class for that purpose and my question is if there is any way to define
those methods (dynamically) to marshall and unmarshall the xml
file.
Here's an example so you can understand better my
question:
1- I create 2 forms dynamically: "Sales"
and "Addess Book"
2- Then i set fields 'product', 'price'
for the form "Sales" and set fields 'name','telefone' for the form "Adress
Book"
3- After create the forms i open the form
"Sales" and he want to input information about a product.
Here is my problem. In normal conditions i
should have two classes (Sales.class and AddrBook.class) with the
methods "setProduct( ... )/ ...getProduct()" and "setPrice( ... ) /...
getPrice()" for the form "Sales" and "setName( ... )/ ...getName()"
and "setTelefone( ... ) /... getTelefone()" for the form "Address Book" .
But once the forms were created dynamically i couldn't know what methods to
define and how many classes.....
So, i'm trying to create only one class that can
make the setters/getters no matter what are the fields in the form.
Is it possible with castor? I can i do it? |
