You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2019/04/04 14:41:29 UTC

[GitHub] [sling-org-apache-sling-caconfig-api] stefanseifert commented on a change in pull request #2: [SLING-8272] Check if Caconfig Node Exists in JCR

stefanseifert commented on a change in pull request #2: [SLING-8272] Check if Caconfig Node Exists in JCR
URL: https://github.com/apache/sling-org-apache-sling-caconfig-api/pull/2#discussion_r272213780
 
 

 ##########
 File path: src/main/java/org/apache/sling/caconfig/ConfigurationBuilder.java
 ##########
 @@ -86,4 +86,15 @@
      */
     @NotNull <T> Collection<T> asAdaptableCollection(@NotNull Class<T> clazz);
 
+    /**
+     * Check if the configuration node is existing in the JCR. 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}
+     * 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.
+     */
+    @NotNull <T> boolean has(@NotNull Class<T> clazz);
 
 Review comment:
   this method only supports the use case of using a configuration annotation class with the ConfigurationBuilder.
   but it is also possible to use the ConfigurationBuilder without such a class - by using the asValueMap, asValueMapCollection, asAdaptable methods, as adaptableCollection - all these methods required a name to be given by the "name" method.
   so we need a "has" variant as well for those use cases - either by adding a "has()" method which required a name given before, or by adding a has(String) method which accepts the name. not sure what is the better usage pattern.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services