You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Mark Derricutt <ma...@talios.com> on 2008/07/28 03:45:32 UTC

Generic models involving List's

hey all,

Last night I was migrating some old code away from Wicket 2.0 over to Wicket
1.4-m3 and had to change my backing API slightly.

I had a Model instance that received a List<User> from my back end which was
returned as Object, genericising this I expected to simply use
Model<List<User>> but soon discovered that Model<> required a Serializable
(quite understandable), but given that the List interface isn't
Serialiazable I had to change my API to return an ArrayList<User> instead (I
could simply created a new ArrayList and added the List contents, which
would be better).

It's not really a big issue but I wondered if how other people were takling
this?  For Model's wrapping collections, are you all using ArrayList or some
other concrete implementation?

-- 
"It is easier to optimize correct code than to correct optimized code." --
Bill Harlan

Re: Generic models involving List's

Posted by Igor Vaynberg <ig...@gmail.com>.
its in core's trunk i believe.

-igor

On Mon, Jul 28, 2008 at 4:33 AM, Mark Derricutt <ma...@talios.com> wrote:
> What package is that defined in?  I don't see that in wicket core or wicket
> extensions?
>
>
> On Mon, Jul 28, 2008 at 2:26 PM, Igor Vaynberg <ig...@gmail.com>wrote:
>
>> there is org.apache.wicket.model.util.ListModel
>>
>
> --
> "It is easier to optimize correct code than to correct optimized code." --
> Bill Harlan
>

Re: Generic models involving List's

Posted by Mark Derricutt <ma...@talios.com>.
What package is that defined in?  I don't see that in wicket core or wicket
extensions?


On Mon, Jul 28, 2008 at 2:26 PM, Igor Vaynberg <ig...@gmail.com>wrote:

> there is org.apache.wicket.model.util.ListModel
>

-- 
"It is easier to optimize correct code than to correct optimized code." --
Bill Harlan

Re: Generic models involving List's

Posted by Mark Derricutt <ma...@talios.com>.
Ahh cool ;-)  Excellent.

On Mon, Jul 28, 2008 at 2:26 PM, Igor Vaynberg <ig...@gmail.com>wrote:

> there is org.apache.wicket.model.util.ListModel
>

-- 
"It is easier to optimize correct code than to correct optimized code." --
Bill Harlan

Re: Generic models involving List's

Posted by Igor Vaynberg <ig...@gmail.com>.
there is org.apache.wicket.model.util.ListModel

-igor

On Sun, Jul 27, 2008 at 7:07 PM, James Carman
<ja...@carmanconsulting.com> wrote:
> Isn't there a static wrapper method on Model that takes a List?
>
> On Sun, Jul 27, 2008 at 9:45 PM, Mark Derricutt <ma...@talios.com> wrote:
>> hey all,
>>
>> Last night I was migrating some old code away from Wicket 2.0 over to Wicket
>> 1.4-m3 and had to change my backing API slightly.
>>
>> I had a Model instance that received a List<User> from my back end which was
>> returned as Object, genericising this I expected to simply use
>> Model<List<User>> but soon discovered that Model<> required a Serializable
>> (quite understandable), but given that the List interface isn't
>> Serialiazable I had to change my API to return an ArrayList<User> instead (I
>> could simply created a new ArrayList and added the List contents, which
>> would be better).
>>
>> It's not really a big issue but I wondered if how other people were takling
>> this?  For Model's wrapping collections, are you all using ArrayList or some
>> other concrete implementation?
>>
>> --
>> "It is easier to optimize correct code than to correct optimized code." --
>> Bill Harlan
>>
>

Re: Generic models involving List's

Posted by James Carman <ja...@carmanconsulting.com>.
Isn't there a static wrapper method on Model that takes a List?

On Sun, Jul 27, 2008 at 9:45 PM, Mark Derricutt <ma...@talios.com> wrote:
> hey all,
>
> Last night I was migrating some old code away from Wicket 2.0 over to Wicket
> 1.4-m3 and had to change my backing API slightly.
>
> I had a Model instance that received a List<User> from my back end which was
> returned as Object, genericising this I expected to simply use
> Model<List<User>> but soon discovered that Model<> required a Serializable
> (quite understandable), but given that the List interface isn't
> Serialiazable I had to change my API to return an ArrayList<User> instead (I
> could simply created a new ArrayList and added the List contents, which
> would be better).
>
> It's not really a big issue but I wondered if how other people were takling
> this?  For Model's wrapping collections, are you all using ArrayList or some
> other concrete implementation?
>
> --
> "It is easier to optimize correct code than to correct optimized code." --
> Bill Harlan
>