You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by pa...@apache.org on 2020/01/16 14:59:33 UTC

[sling-org-apache-sling-feature] branch master updated: SLING-8998: Add a getExcat method to Artifact.

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 3c06935  SLING-8998: Add a getExcat method to Artifact.
3c06935 is described below

commit 3c069354d09da40f379c1483e4c3270c1659e922
Author: Karl Pauls <ka...@gmail.com>
AuthorDate: Thu Jan 16 15:59:19 2020 +0100

    SLING-8998: Add a getExcat method to Artifact.
---
 src/main/java/org/apache/sling/feature/Artifacts.java | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/main/java/org/apache/sling/feature/Artifacts.java b/src/main/java/org/apache/sling/feature/Artifacts.java
index f756d10..09fa233 100644
--- a/src/main/java/org/apache/sling/feature/Artifacts.java
+++ b/src/main/java/org/apache/sling/feature/Artifacts.java
@@ -87,6 +87,21 @@ public class Artifacts extends ArrayList<Artifact> {
     }
 
     /**
+     * Get the artifact for the given id
+     *
+     * @param id The artifact id
+     * @return The artifact or {@code null} otherwise
+     */
+    public Artifact getExact(final ArtifactId id) {
+        for (final Artifact artifact : this) {
+            if (artifact.getId().equals(id)) {
+                return artifact;
+            }
+        }
+        return null;
+    }
+
+    /**
      * Checks whether the exact artifact is available
      * @param id The artifact id.
      * @return {@code true} if the artifact exists