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

Igor Vaynberg resolved WICKET-2374.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.4.1
         Assignee: Igor Vaynberg

> Model's factory methods are inconsistent
> ----------------------------------------
>
>                 Key: WICKET-2374
>                 URL: https://issues.apache.org/jira/browse/WICKET-2374
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>            Reporter: Peter Ertl
>            Assignee: Igor Vaynberg
>             Fix For: 1.4.1
>
>         Attachments: model-of.patch
>
>
> When looking at the factory methods of org.apache.wicket.model.Model I think 
> that the naming of the static factory methods is not consistent:
>   Model.of(Collection)
>   Model.of(List) 
>   Model.of(Set)
>   Model.ofMap(Map)
> I think it would be better to have these:
>   Model.of(Collection)
>   Model.ofList(List) 
>   Model.ofSet(Set)
>   Model.ofMap(Map)
> Reasons:
>  - Naming is consistent
>  - When using a concrete type of collection, for example Model.ofList() for 
> feeding a list view you don't want a different type like a Map or Set to be 
> swapped in. From just looking at Model.of(items) you get no indication that 
> list is required but only after getting a compile error later. I think the 
> level of verbosity of having the type after "of" is helpful in most cases. 
> you can get the type of collection from just looking at the method name 
> (otherwise you have to scroll up and look for the type declaration or type 
> some hotkey in your IDE to get the type, how cumbersome :-). if you don't 
> need some concrete collection type you can still use Model.of(Collection).
> I attached a patch to implement the proposed naming (and deprecate the 
> previous methods)
> would be great to get this in before going final :-)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to