[email protected] wrote: > > On Sat, Feb 12, 2011 at 7:56 AM, Willis Blackburn <[email protected]> > wrote: > > As a side note, rarely should you ever use Model class for a list of > things, > especially things loaded from a database. If you then pass that model to > a > component, all the things in it will be serialized. > >
I'm sorry that I said that I loaded the list from a database, since that has apparently created a distraction from my key point, which is that if you start with a List<C> and pass it to Model.listOf, you get back something that is not a List<C>, which is undesirable and perhaps unnecessary. > So use the Model constructors instead. The factory methods are just there > to help remove some verbosity related to generics. > Have you tried this yourself? Because it doesn't work. You can only instantiate Model with a Serializable instance, and java.util.List does not implement Serializable. The whole point of the ofList method is to generate serializable lists, and the documentation even says so: "This factory method will automatically rebuild a nonserializable list into a serializable one." You're confusing Model.listOf with Model.of. W -- Jeremy Thomerson http://wickettraining.com *Need a CMS for Wicket? Use Brix! http://brixcms.org* -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Unfriendly-Model-ofList-etc-methods-can-anything-be-done-tp3302712p3302752.html Sent from the Users forum mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
