Ok, here is my test, which is working in the latest generics code.

// class MyPageClass implements MyInterface<MyGridRowType>  {
public class GridGenericSourceDemo implements GenericGridPage<Person> {
    @Component
    private Grid grid;

    @Inject
    @Property
    private GenericDatabase<Person> personDatabase;

    public Person getRow() {}
    public void setRow(Person person) {}
}

// interface MyInterface<T extends GridRowSupertype> {
public interface GenericGridPage<T extends GenericDatabaseItem> {

}


// interface GridRowSupertype {
public interface GenericDatabaseItem<T> extends Cloneable


// class MyGridRowType implements GridRowSupertype {
public class Person implements GenericDatabaseItem<Person>

GridGenericSourceDemo.tml contains

<table t:id="grid" source="personDatabase.findAll()" row="row">
    <t:parameter name="nameCell">The Name ${row.name}</t:parameter>
</table>


Josh

On Fri, Sep 10, 2010 at 2:17 PM, danrwilliams
<dan_r_willi...@yahoo.co.uk> wrote:
>
> Hi,
>
> I am trying to standardise the way our developers code a page class that
> uses a Grid component.  Part of this process is defining an interface that
> contains the get/set methods for the property used in the row parameter of
> the Grid component.
>
> Since the data used in any Grid in our project will always extend from a
> specific super-type, I have created a bounded generic interface to give type
> safety to the get/set methods in the page class.
>
> The problem is, Tapestry 5.1.0.5 doesn't seem to honour this.
>
> I'll try to illustrate..
>
> Our code looks something like this;
>
> class MyPageClass implements MyInterface<MyGridRowType>  {
> ...
> ...
>   @Override
>   public MyGridRowType getRow() {...}
>
>   @Override
>   public void setRow(MyGridRowType row) {...}
>
> ...
> }
>
> interface MyInterface<T extends GridRowSupertype> {
>
>   T getRow():
>
>   void setRow(T row):
> }
>
> interface GridRowSupertype {
>   String getStringA();
> }
>
> class MyGridRowType implements GridRowSupertype {
>
>   @Override
>   public String getStringA() {...}
>
>   public String getStringB() {...}
> }
>
> Now, in the Grid component in our template file, if I try to use
> '${row.stringb}' Tapestry throws an exception saying;
>
> "...Class GridRowSupertype does not contain a property named 'stringb'...
> ...Available properties: stringa..."
>
> Even though this is technically correct, Tapestry is referencing the
> super-type and not the sub-type supplied by the page class.  The return type
> on the getRow() method in the page class is MyGridRowType, which does
> contain the required method (getStringB).
>
> I have confirmed this by simply removing the interface 'MyInterface' from
> the page class and everything works fine.
>
> Any suggestions?
>
> Thanks,
> Dan
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/Generics-problem-with-Grid-row-parameter-tp2835598p2835598.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
>
>



-- 
--
http://www.bodylabgym.com - a private, by appointment only, one-on-one
health and fitness facility.
--
http://www.ectransition.com - Quality Electronic Cigarettes at a
reasonable price!
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

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

Reply via email to