You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Luke Ma <lu...@lukema.net> on 2008/11/05 03:05:23 UTC
PropertyColumn and generics
I'm writing a custom BooleanChoiceFilteredPropertyColumn<T> extends
ChoiceFilteredPropertyColumn<T> (on 1.4-m3). When implementing
@Override
public void populateItem(final Item cellItem, final String componentId,
final IModel model)
I get a warning about Item and IModel needing to be parameterized. Makes
sense. But if I parameterize it, I get:
Name clash: The method populateItem(Item<ICellPopulator<T>>, String,
IModel<T>) of type BooleanChoiceFilteredPropertyColumn<T> has the same
erasure as populateItem(Item, String, IModel) of type PropertyColumn<T> but
does not override it BooleanChoiceFilteredPropertyColumn.java
So it turns out that even though Item and IModel have been generified (as
well as PropertyColumn), the signature of populateItem in PropertyColumn is
still:
public void populateItem(Item item, String componentId, IModel model)
Shouldn't that be:
public void populateItem(Item<ICellPopulator<T>> item, String componentId,
IModel<T> model)
, the way it is in ICellPopulator? Am I smoking or misunderstanding
generics?
Luke
--
View this message in context: http://www.nabble.com/PropertyColumn-and-generics-tp20335170p20335170.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: PropertyColumn and generics
Posted by Luke Ma <lu...@lukema.net>.
And while we're on the subject, why is ChoiceFilteredPropertyColumn's
constructor declared as
public ChoiceFilteredPropertyColumn(IModel<String> displayModel, String
sortProperty,
String propertyExpression, IModel<List<? extends T>> filterChoices)
Why must filterChoices be a list of the parameterized type? What about the
case where I might want a custom filter and pass in a List<Boolean>, for
example?
Luke
Luke Ma wrote:
>
> I'm writing a custom BooleanChoiceFilteredPropertyColumn<T> extends
> ChoiceFilteredPropertyColumn<T> (on 1.4-m3). When implementing
>
> @Override
> public void populateItem(final Item cellItem, final String componentId,
> final IModel model)
>
> I get a warning about Item and IModel needing to be parameterized. Makes
> sense. But if I parameterize it, I get:
>
> Name clash: The method populateItem(Item<ICellPopulator<T>>, String,
> IModel<T>) of type BooleanChoiceFilteredPropertyColumn<T> has the same
> erasure as populateItem(Item, String, IModel) of type PropertyColumn<T>
> but does not override it BooleanChoiceFilteredPropertyColumn.java
>
> So it turns out that even though Item and IModel have been generified (as
> well as PropertyColumn), the signature of populateItem in PropertyColumn
> is still:
>
> public void populateItem(Item item, String componentId, IModel model)
>
> Shouldn't that be:
>
> public void populateItem(Item<ICellPopulator<T>> item, String
> componentId, IModel<T> model)
>
> , the way it is in ICellPopulator? Am I smoking or misunderstanding
> generics?
>
> Luke
>
--
View this message in context: http://www.nabble.com/PropertyColumn-and-generics-tp20335170p20335387.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org