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

simonetripodi pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-apiregions-model.git


The following commit(s) were added to refs/heads/master by this push:
     new 68408d9  added method to check if a region exports locally an API, 
without climbing the whole regions hierarchy
68408d9 is described below

commit 68408d9df57372b776042deadcdcf51019d4a54c
Author: stripodi <[email protected]>
AuthorDate: Wed Apr 10 23:31:40 2019 +0200

    added method to check if a region exports locally an API, without
    climbing the whole regions hierarchy
---
 .../apache/sling/feature/apiregions/model/ApiRegion.java  | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git 
a/src/main/java/org/apache/sling/feature/apiregions/model/ApiRegion.java 
b/src/main/java/org/apache/sling/feature/apiregions/model/ApiRegion.java
index 3e2e620..e6160fb 100644
--- a/src/main/java/org/apache/sling/feature/apiregions/model/ApiRegion.java
+++ b/src/main/java/org/apache/sling/feature/apiregions/model/ApiRegion.java
@@ -165,6 +165,19 @@ public final class ApiRegion implements Iterable<String> {
     }
 
     /**
+     * Checks if the input API is stored only in this region.
+     *
+     * @param api the API package to remove
+     * @return true if the API is stored in this region, false otherwise.
+     */
+    public boolean exports(String api) {
+        if (isEmpty(api)) {
+            return false;
+        }
+        return apis.contains(api);
+    }
+
+    /**
      * Check is the region contains, across the whole region hierarchy,
      * if the input API package is contained.
      * 
@@ -176,7 +189,7 @@ public final class ApiRegion implements Iterable<String> {
             return false;
         }
 
-        if (apis.contains(api)) {
+        if (exports(api)) {
             return true;
         }
 

Reply via email to