[ 
https://issues.apache.org/jira/browse/WICKET-4041?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Igor Vaynberg resolved WICKET-4041.
-----------------------------------

    Resolution: Invalid
      Assignee: Igor Vaynberg

for non-serializable things use LoadableDetachableModel<T>

for lists you actually want to store in session (which is what Model<T> does), 
use Model.of(List) which will auto-convert your list to an array list

> In Model<T>, the type T should not extend Serializable.
> -------------------------------------------------------
>
>                 Key: WICKET-4041
>                 URL: https://issues.apache.org/jira/browse/WICKET-4041
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.5-RC7
>            Reporter: Craig P. Motlin
>            Assignee: Igor Vaynberg
>
> The problem is that lots of common interfaces (like List) don't implement 
> Serializable even though most/all of their subclasses are in fact 
> serializable. That means clients wind up with code containing potentially 
> unsafe casts like this.
>               Model<ArrayList<MyDomainObject>> listModel = new 
> Model<ArrayList<MyDomainObject>>()
>               {
>                       @Override
>                       public ArrayList<MyDomainObject> getObject()
>                       {
>                               return (ArrayList<MyDomainObject>) 
> DominionApplication.get().getMyDomainObjects();
>                       }
>               };
> It still makes sense for Model to check that the type is an instanceof 
> Serializable at runtime, but it's too much to enforce at compile time.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to