This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git


The following commit(s) were added to refs/heads/master by this push:
     new 6c82bfa  Revert "SLING-8271 allow to skip child traversal with a new 
visit method"
6c82bfa is described below

commit 6c82bfa4a8a3344f6cde99a29c2a3097d243d8e5
Author: Konrad Windszus <[email protected]>
AuthorDate: Wed Feb 20 09:43:14 2019 +0100

    Revert "SLING-8271 allow to skip child traversal with a new visit method"
    
    This reverts commit 450d37af0482a14e88c65349ce512f6c46aa7d9c.
---
 .../api/resource/AbstractResourceVisitor.java      | 24 ++++++----------------
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/api/resource/AbstractResourceVisitor.java 
b/src/main/java/org/apache/sling/api/resource/AbstractResourceVisitor.java
index cfeabb2..e152a5f 100644
--- a/src/main/java/org/apache/sling/api/resource/AbstractResourceVisitor.java
+++ b/src/main/java/org/apache/sling/api/resource/AbstractResourceVisitor.java
@@ -23,23 +23,24 @@ import java.util.Iterator;
 import org.jetbrains.annotations.NotNull;
 
 /**
- * This visitor will traverse the given resource and all its children in a 
depth-first approach
- * and call the {@link 
AbstractResourceVisitor#visitAndContinueWithChildren(Resource)} method for each 
visited resource.
+ * This visitor will traverse the given resource and all its children in a 
breadth-first approach
+ * and call the {@link AbstractResourceVisitor#visit(Resource)} method for 
each visited resource.
  * It decouples the actual traversal code from application code. 
  * 
  * Concrete subclasses must implement the {@link 
AbstractResourceVisitor#visit(Resource)} method.
  *
- * @see <a 
href="https://en.wikipedia.org/wiki/Depth-first_search";>Depth-First-Search</a>
+ * @see <a 
href="https://en.wikipedia.org/wiki/Breadth-first_search";>Breadth-First-Search</a>
  * @since 2.2 (Sling API Bundle 2.2.0)
  */
 public abstract class AbstractResourceVisitor {
 
     /**
-     * Visit the given resource and all its descendants in a depth-first 
approach.
+     * Visit the given resource and all its descendants.
      * @param res The resource
      */
     public void accept(final Resource res) {
-        if (res != null && visitAndContinueWithChildren(res)) {
+        if (res != null) {
+            this.visit(res);
             this.traverseChildren(res.listChildren());
         }
     }
@@ -58,20 +59,7 @@ public abstract class AbstractResourceVisitor {
 
     /**
      * Implement this method to do actual work on the resources.
-     * In most of the cases one should rather override {@link 
#visitAndContinueWithChildren(Resource)} which allows to limit the traversal.
      * @param res The resource
      */
     protected abstract void visit(final @NotNull Resource res);
-
-    /**
-     * Implement this method to do actual work on the resources and to 
indicate whether to traverse also the given resource's children.
-     * The default implementation just calls {@link 
AbstractResourceVisitor#visit(Resource)} and returns {@code true}
-     * @param res The resource
-     * @return {@code true} in case the traversal should also cover the 
children of {@link #res}.
-     * @since 2.12.0
-     */
-    protected boolean visitAndContinueWithChildren(final @NotNull Resource 
res) {
-        visit(res);
-        return true;
-    }
 }

Reply via email to