You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2019/05/10 11:36:27 UTC

[sling-org-apache-sling-caconfig-api] 28/31: [SLING-8272] Added additional method - PR Comments

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-caconfig-api.git

commit 5e94d1e3850835333e23da9b926c08045d9f6d40
Author: ompandey <om...@gmail.com>
AuthorDate: Fri May 3 10:25:57 2019 +0200

    [SLING-8272] Added additional method - PR Comments
---
 .../sling/caconfig/ConfigurationBuilder.java       | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/sling/caconfig/ConfigurationBuilder.java b/src/main/java/org/apache/sling/caconfig/ConfigurationBuilder.java
index 4014206..592b80a 100644
--- a/src/main/java/org/apache/sling/caconfig/ConfigurationBuilder.java
+++ b/src/main/java/org/apache/sling/caconfig/ConfigurationBuilder.java
@@ -32,7 +32,7 @@ public interface ConfigurationBuilder {
 
     /**
      * Define configuration name.
-     * Optional for the {@link #as(Class)} and {@link #asCollection(Class)}, mandatory for the others.
+     * Optional for the {@link #as(Class)}, {@link #asCollection(Class)} and {@link #has(Class)} methods, mandatory for the others.
      * @param configName Relative path
      * @return Configuration builder
      */
@@ -87,13 +87,25 @@ public interface ConfigurationBuilder {
     @NotNull <T> Collection<T> asAdaptableCollection(@NotNull Class<T> clazz);
 
     /**
-     * Check if the configuration node is existing in the resource hierarchy. This method checks for the configuration existence based on {@code configName} 
-     * defined in the configuration definition. It checks if the configuration is available for the context path in the current resource hierarchy and if not 
-     * found, also checks in the global fall-back paths configured via {@link org.apache.sling.caconfig.resource.impl.def.DefaultConfigurationResourceResolvingStrategy}
+     * This method checks for the configuration existence based on {@code configName} defined in the configuration definition. It extracts the {@code configName} 
+     * from the given annotation class and checks if the configuration is available for the context path in the current resource hierarchy. If not found, also
+     * checks in the global fall-back paths configured via {@link org.apache.sling.caconfig.resource.impl.def.DefaultConfigurationResourceResolvingStrategy}
+     * which by default are {@code /conf/global}, {@code /apps/config} and {@code /libs/config}.This method does not consider the default values provided in
+     * the configuration definition.
+     * @param clazz Class that can be adapted from a {@link org.apache.sling.api.resource.Resource}
+     * @param <T> Annotation class type
+     * @return True/False based on configuration resource node existence in JCR.
+     */
+    <T> boolean has(@NotNull Class<T> clazz);
+
+    /**
+     * This method checks for the configuration existence based on provided {@code configName} value.
+     * It checks if the configuration is available for the context path in the current resource hierarchy and if not found, also
+     * checks in the global fall-back paths configured via {@link org.apache.sling.caconfig.resource.impl.def.DefaultConfigurationResourceResolvingStrategy}
      * which by default are {@code /conf/global}, {@code /apps/config} and {@code /libs/config}.This method does not consider the default values provided in
      * the configuration definition.
      * @param configName Name of the configuration
      * @return True/False based on configuration resource node existence in JCR.
      */
-    boolean has(@NotNull String configName);
+    <T> boolean has(String configName);
 }