You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Justin Edelson (JIRA)" <ji...@apache.org> on 2012/10/31 18:19:14 UTC
[jira] [Comment Edited] (SLING-2641) Make listChildren() Iterable
[ https://issues.apache.org/jira/browse/SLING-2641?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13487949#comment-13487949 ]
Justin Edelson edited comment on SLING-2641 at 10/31/12 5:17 PM:
-----------------------------------------------------------------
+1 to adding Iterable<Resource> getChildren() to Resource interface.
...except extending this interface is going to cause some pain for implementors.
How about this..
1) create a ResourceIterableAdapter class which implements Iterable<Resource> - this is used by Java code
2) add a EL function sling:children(resource) which can be used in JSP pages
WDYT?
was (Author: justinedelson):
+1 to adding Iterable<Resource> getChildren() to Resource interface.
> Make listChildren() Iterable
> ----------------------------
>
> Key: SLING-2641
> URL: https://issues.apache.org/jira/browse/SLING-2641
> Project: Sling
> Issue Type: Improvement
> Components: API, General, ResourceResolver, Testing
> Affects Versions: API 2.2.4
> Reporter: Dan Klco
> Labels: features, noob, patch
> Attachments: SLING-2641-Resource-Iterator.diff
>
>
> When you call Resource.listChildren() or resourceResolver.listChildren() it returns a Iterator<Resource>, this is fine if you want to just iterate through the results using old-style while loops, but if you want to use enhanced loops, you are out of luck.
> I'm proposing adding an interface to return from these methods which extends both Iterator<Resource> and Iterable<Resource>. This will allow for using enhanced loops with the results of listChildren().
--
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