Thanks Werner. The problem here was that i wanted a generic method. At first,
i dont know what kind of subclasses are avaliable because they are managed
by a service so i can add more subclasses just annotating them and i will
have more subproducts avaliable without any code changes. Because of this, i
needed to work with the superclass type. Im going to explain it a bit more
because may be usefull for anybody else.

Think on a extensible shop. I have my base products with the basic fields
(Id, Name..).

At any time, i need some new kinds of products with different fields so i
create some subclasses of my base class Product.

The problem, as i said, is that at first, i dont know what kind of products
i have avaliable since its dinamic depending on the classes i added and may
change at any time depending on my needs and i want it to be extensible
without having to hardcode the changes for the new subproduct. I want it to
be added as a Product subclass, annotate it and get it working without more
changes. Because of this, i annotate these Product subclasses and through
annotations and reflections they are registered into a custom service.

Now i want a page where i can select some kind of product through a select
box and get a beanEditForm where i can create a new "subproduct". The
problem is that the beanEditForm has to accept a generic type (the
superclass) and adapt the fields to the kind of product selected. 

I solved it setting the beanEditForm model through a method, and this metod
creates the BeanModel based on the selected suproduct.

I will make a tutorial about this asap.

Hope you understand.

Thx again for your help ;)
-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/BeanEditForm-and-Polymorphism-tp3343510p3344059.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to