You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by st...@apache.org on 2015/10/22 17:33:07 UTC

svn commit: r1710038 - /sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/BaseTopologyView.java

Author: stefanegli
Date: Thu Oct 22 15:33:07 2015
New Revision: 1710038

URL: http://svn.apache.org/viewvc?rev=1710038&view=rev
Log:
SLING-5173 : added getInstance(slingId) to simplify things

Modified:
    sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/BaseTopologyView.java

Modified: sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/BaseTopologyView.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/BaseTopologyView.java?rev=1710038&r1=1710037&r2=1710038&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/BaseTopologyView.java (original)
+++ sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/BaseTopologyView.java Thu Oct 22 15:33:07 2015
@@ -102,4 +102,18 @@ public abstract class BaseTopologyView i
             + ", instances=" + sb.toString() + "]";
     }
 
+    /**
+     * Simple getter for a particular slingId
+     * @param slingId the slingId for which to lookup the InstanceDescription
+     * @return the InstanceDescription matching the provided slingId - or null if it doesn't exist
+     */
+    public InstanceDescription getInstance(String slingId) {
+        for (InstanceDescription instance : getInstances()) {
+            if (instance.getSlingId().equals(slingId)) {
+                return instance;
+            }
+        }
+        return null;
+    }
+
 }