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

Felix Meschberger commented on SLING-2723:
------------------------------------------

Having such a method on the ResourceResolver (or the Resource) would be similar 
to File.listFiles() and File.listFiles(FileFilter).

I think listChildren(Filter) is not the same kind of utility as 
adaptTo(Iterator<Resource>, Class). The adaptTo method really is outside of the 
resource resolver because it deals with non-resources. listChildren(Filter) on 
the other hand really deals with resources. So having listChidren(Filter) on 
ResourceResolver seems natural.

As for the specification pattern: AFAICT the Filter in fact is a specification 
and the rest is just combinations. Do we need them ?

The problem I have is, that we add API to both the Resource and 
ResourceResolver interfaces. The ResourceResolver addition is less problematic 
than the Resource addition; whereas the addition to the Resource interface may 
be mitigated by having the AbstractResource default implementation delegate to 
the ResourceResolver (just like for the parameter-less method). Nevertheless we 
have to increase the API export version, which "breaks" existing 
implementations.
                
> Add listChildren(Filter<Resource> filter) to Resource
> -----------------------------------------------------
>
>                 Key: SLING-2723
>                 URL: https://issues.apache.org/jira/browse/SLING-2723
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons
>    Affects Versions: API 2.3.0
>            Reporter: Feike Visser
>            Priority: Minor
>
> Currently there is Resource.listChildren(), this will return all the children 
> of this resource.
> This improvement is to add a listChildren(Filter<Resource> filter) method 
> where you can specify a specific filter to limit the result, so you don't 
> have to code a loop yourself.
> An example can found in the Page-interface.

--
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

Reply via email to