You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (Jira)" <ji...@apache.org> on 2019/08/20 15:37:00 UTC

[jira] [Resolved] (WICKET-6536) Add generic to MarkupContainer#visitChildren

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

Martin Grigorov resolved WICKET-6536.
-------------------------------------
      Assignee: Martin Grigorov  (was: Sven Meier)
    Resolution: Won't Fix

Closing as "Won't fix" because this change would lead to different need for casting.

Very often this method is used not to find `AjaxButton` (or other specific Component) but MyInterface, i.e. a business interface class that some components may implement. In the visit() method the results are usually casted to Component/MarkupContainer and their getId(), isVisible(), etc. methods are used.

With the proposed change the type would be MyInterface instead of Object but the application code will still need to cast to Component most of the time.

I don't see a compelling reason to break the API here. 

> Add generic to MarkupContainer#visitChildren
> --------------------------------------------
>
>                 Key: WICKET-6536
>                 URL: https://issues.apache.org/jira/browse/WICKET-6536
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 8.0.0-M8
>            Reporter: Kamil
>            Assignee: Martin Grigorov
>            Priority: Major
>
> currently MarkupContainer#visitChildren has signature:
> {code:java}
> final <S extends Component, R> R visitChildren(final Class<?> clazz, final IVisitor<S, R> visitor){code}
> while im my opinion it should have:
> {code:java}
> final <S extends Component, R> R visitChildren(final Class<S> clazz, final IVisitor<S, R> visitor){code}
> Why force user to do class cast while we already know which class we pass to the method?



--
This message was sent by Atlassian Jira
(v8.3.2#803003)