This is an automated email from the ASF dual-hosted git repository. jeb pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-filter.git
commit 4c1232372a845e662ba70123e71ec0ad66f502f5 Author: JE Bailey <[email protected]> AuthorDate: Thu Aug 23 11:56:56 2018 -0400 Updated javadoc and Readme --- README.md | 2 +- .../sling/resource/filter/ResourcePredicates.java | 3 ++- .../apache/sling/resource/filter/impl/Context.java | 23 +++++++++++++--------- .../sling/resource/filter/impl/DefaultContext.java | 2 +- .../filter/impl/ResourcePredicateImpl.java | 2 +- .../apache/sling/resource/filter/impl/Visitor.java | 2 -- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 6c235dc..c304bcd 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ resourceCollection.stream().filter(predicate).forEach( `ResourceFilterStream` combines the `ResourceStream` functionality with the `ResourcePredicates` service to provide an ability to define a `Stream<Resource>` that follows specific child pages and looks for specific Resources as defined by the resources filter script. The ResourceStreamFilter is access by adaption. ```java - ResourceStreamFilter rfs = resource.adaptTo(ResourceStreamFilter.class); + ResourceFilterStream rfs = resource.adaptTo(ResourceFilterStream.class); rfs .setBranchSelector("[jcr:primaryType] == 'cq:Page'") diff --git a/src/main/java/org/apache/sling/resource/filter/ResourcePredicates.java b/src/main/java/org/apache/sling/resource/filter/ResourcePredicates.java index 281d106..a72436a 100644 --- a/src/main/java/org/apache/sling/resource/filter/ResourcePredicates.java +++ b/src/main/java/org/apache/sling/resource/filter/ResourcePredicates.java @@ -24,7 +24,8 @@ import java.util.function.Predicate; import org.apache.sling.api.resource.Resource; /** - * + * Service which provides the ability to convert a String into a + * Predicate<Resource> to match against Resource Objects * */ public interface ResourcePredicates { diff --git a/src/main/java/org/apache/sling/resource/filter/impl/Context.java b/src/main/java/org/apache/sling/resource/filter/impl/Context.java index 798293f..e30d10c 100644 --- a/src/main/java/org/apache/sling/resource/filter/impl/Context.java +++ b/src/main/java/org/apache/sling/resource/filter/impl/Context.java @@ -44,14 +44,6 @@ public interface Context { */ Context removeFunction(String name); - /** - * Allows an object to be represented in the script for evaluation. - * - * @param name of the argument - * @param object value that is represented - * @return this Context - */ - Context addArgument(String name, Object object); /** * Retrieve the currently defined Logic Visitor @@ -97,11 +89,24 @@ public interface Context { */ Optional<Object> getParameter(String name); + /** + * Allows an object to be represented in the script for evaluation. + * + * @param name of the argument + * @param object value that is represented + * @return this Context + */ + Context addParameter(String name, Object object); + /** + * Adds the provided Map to the underlying parameter map. + * + * @param params + */ void addParameters(Map<String, Object> params); /** - * Allows an object to be represented in the script for evaluation. + * Replaces the underlying parameter Map with the one provided * * @param name of the argument * @param object value that is represented diff --git a/src/main/java/org/apache/sling/resource/filter/impl/DefaultContext.java b/src/main/java/org/apache/sling/resource/filter/impl/DefaultContext.java index 8a63932..95158d9 100644 --- a/src/main/java/org/apache/sling/resource/filter/impl/DefaultContext.java +++ b/src/main/java/org/apache/sling/resource/filter/impl/DefaultContext.java @@ -45,7 +45,7 @@ public class DefaultContext implements Context { } @Override - public Context addArgument(String name, Object object) { + public Context addParameter(String name, Object object) { parameters.put(name, object); return this; } diff --git a/src/main/java/org/apache/sling/resource/filter/impl/ResourcePredicateImpl.java b/src/main/java/org/apache/sling/resource/filter/impl/ResourcePredicateImpl.java index 060ec2e..304f38d 100644 --- a/src/main/java/org/apache/sling/resource/filter/impl/ResourcePredicateImpl.java +++ b/src/main/java/org/apache/sling/resource/filter/impl/ResourcePredicateImpl.java @@ -92,7 +92,7 @@ public class ResourcePredicateImpl implements ResourcePredicates { @Override public ResourcePredicateBuilder withParameter(String key, Object value) { - context.addArgument(key, value); + context.addParameter(key, value); return this; } diff --git a/src/main/java/org/apache/sling/resource/filter/impl/Visitor.java b/src/main/java/org/apache/sling/resource/filter/impl/Visitor.java index de9ec58..b9c234d 100644 --- a/src/main/java/org/apache/sling/resource/filter/impl/Visitor.java +++ b/src/main/java/org/apache/sling/resource/filter/impl/Visitor.java @@ -13,8 +13,6 @@ */ package org.apache.sling.resource.filter.impl; -import java.text.ParseException; - import org.apache.sling.resource.filter.impl.node.Node; /**
