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 2013/05/02 16:44:16 UTC

[jira] [Resolved] (WICKET-5124) Improve ResourceReference#getDependencies() API

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

Martin Grigorov resolved WICKET-5124.
-------------------------------------

    Resolution: Fixed

Changed the return type to "List<HeaderItem>" and ResourceReference#getDependencies() returns "new ArrayList<>" so the specializations can do:

List<HeaderItem> dependencies = super.getDependencies();
		dependencies.add(dep1);
		dependencies.add(dep2);
		return dependencies;

                
> Improve ResourceReference#getDependencies() API
> -----------------------------------------------
>
>                 Key: WICKET-5124
>                 URL: https://issues.apache.org/jira/browse/WICKET-5124
>             Project: Wicket
>          Issue Type: Improvement
>    Affects Versions: 6.6.0
>            Reporter: Igor Vaynberg
>            Assignee: Martin Grigorov
>             Fix For: 7.0
>
>
> currently the signature is
> public Iterable<? extends HeaderItem> getDependencies()
> which is awkward to use.
> suppose i want a javascript reference that should include a css reference as a dependency, i cannot simply add it to iterable like this:
> new ResourceReference(Some.class, "some.js") {
>    Iterable getDependencies() {
>      Iterable supers=super.getDependencies();
>      // supers.add(CSS); <=== cannot do this, instead
>      List list=new ArrayList();
>      for (reference:supers) {
>         list.add(reference);
>      }
>      // now i can finally add mine
>      list.add(CSS);
>      return list;
>    }
> }
> instead  change Iterable to a List that is backed by a mutable one. this should make extending much easier. if List is too "open" create Appendable { append(); } backed by a list and use that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira