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

Reply via email to