sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julian Sedding (JIRA)" <>
Subject [jira] [Commented] (SLING-8271) Improve AbstractResourceVisitor to allow to stop visiting child resources
Date Tue, 12 Feb 2019 14:56:00 GMT


Julian Sedding commented on SLING-8271:

I see this is already committed. But not yet released.

Maybe a method {{boolean shouldVisitChildren(Resource)}} or even {{boolean skipChildren(Resource)}}
could help avoid long method names and more importantly conflating the visiting and traversing

Something along those lines:
    public void accept(final Resource res) {
        if (res != null) {
            if (shouldVisitChildren(res)) { // default impl returns true

> Improve AbstractResourceVisitor to allow to stop visiting child resources
> -------------------------------------------------------------------------
>                 Key: SLING-8271
>                 URL:
>             Project: Sling
>          Issue Type: Improvement
>          Components: API
>    Affects Versions: API 2.20.0
>            Reporter: Konrad Windszus
>            Assignee: Konrad Windszus
>            Priority: Major
>             Fix For: API 2.20.2
>          Time Spent: 20m
>  Remaining Estimate: 0h
> Currently the AbstractResourceVisitor (
completely decouples the {{visit}} method from the actual resource traversal. That means it
is currently rather hard to programmatically add a break condition which should lead to no
further descending into child resources.
> I propose to extend {{AbstractResourceVisitor}} by an additional visit method which is
supposed to return a boolean value. Only if {{true}} is returned it will further descend into
the children of the current resource. The default implementation should just return {{true}}
to make this change backwards compatible.

This message was sent by Atlassian JIRA

View raw message