[ 
https://issues.apache.org/jira/browse/WICKET-5866?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14386513#comment-14386513
 ] 

Jonas commented on WICKET-5866:
-------------------------------

+1. This has been a hassle ever since IConverter got the type parameter. I'd 
even consider to get rid of the IConverter type parameter all together, since 
only IConverter implementations benefit from it, but implementing your own 
IConverter seems to be a rather rare use case (in my experience).

> Reconsider generics of IConverterLocator#getConverter()
> -------------------------------------------------------
>
>                 Key: WICKET-5866
>                 URL: https://issues.apache.org/jira/browse/WICKET-5866
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 7.0.0
>            Reporter: Sven Meier
>            Assignee: Sven Meier
>            Priority: Minor
>             Fix For: 8.0.0-M1
>
>
> IConverterLocator#getConverter() has a generic parameter <C> currently.
> It seems to me that this is not very useful: almost all code calling 
> #getConverter() does not care for the type parameter.
> From the user perspective it's very common to override 
> Component#getConverter(). With the need for a cast and to suppress the 
> generics warning, providing a custom converter is much too hard currently:
> {code}
>     public <C> IConverter<C> getConverter(Class<C> clazz)
>      {
>          if (Date.class.isAssignableFrom(clazz))
>          {
>              @SuppressWarnings("unchecked")
>              IConverter<C> result = (IConverter<C>)converter;
>              return result;
>          }
>          else
>          {
>              return super.getConverter(clazz);
>          }
>      }
> {code}
> I propose to remove the generics parameter from the method.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to