You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by slowery23 <sl...@gatessolutions.com> on 2008/11/25 17:36:08 UTC

ListView vs DropDownChoice with Generics

I have created a subclass to LoadableDetachableModel to retrieve a list of
objects out of our database.  If I declare my class as

public class MyModel extends LoadableDetachableModel<List<MyObject>> 

I can create an instance of this model to pass into a ListView, but that
same Model object cannot be passed into a DropDownChoice because its
contructor wants a IModel<List<? extends MyObject>> and as far as I know I
can't just do a cast.

Why are these constructors between ListView and different?  Has anyone else
dealt with this?  It seems strange that I can't create a Model object that
can be used by both a ListView and a DropDownChoice.


-- 
View this message in context: http://www.nabble.com/ListView-vs-DropDownChoice-with-Generics-tp20684801p20684801.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: ListView vs DropDownChoice with Generics

Posted by Jeremy Thomerson <je...@wickettraining.com>.
I have come across the same issue - is there any valid reason for the "?
extends T" - it would be much simpler if it were just List<T>.

On Tue, Nov 25, 2008 at 10:36 AM, slowery23 <sl...@gatessolutions.com>wrote:

>
> I have created a subclass to LoadableDetachableModel to retrieve a list of
> objects out of our database.  If I declare my class as
>
> public class MyModel extends LoadableDetachableModel<List<MyObject>>
>
> I can create an instance of this model to pass into a ListView, but that
> same Model object cannot be passed into a DropDownChoice because its
> contructor wants a IModel<List<? extends MyObject>> and as far as I know I
> can't just do a cast.
>
> Why are these constructors between ListView and different?  Has anyone else
> dealt with this?  It seems strange that I can't create a Model object that
> can be used by both a ListView and a DropDownChoice.
>
>
> --
> View this message in context:
> http://www.nabble.com/ListView-vs-DropDownChoice-with-Generics-tp20684801p20684801.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
>
>


-- 
Jeremy Thomerson
http://www.wickettraining.com