This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.discovery.commons-1.0.0 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-discovery-commons.git
commit 8d224852e1a62a42143a007fbd15196dc5ceb2af Author: Stefan Egli <[email protected]> AuthorDate: Thu Oct 22 15:33:07 2015 +0000 SLING-5173 : added getInstance(slingId) to simplify things git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/discovery/commons@1710038 13f79535-47bb-0310-9956-ffa450edef68 --- .../discovery/commons/providers/BaseTopologyView.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/org/apache/sling/discovery/commons/providers/BaseTopologyView.java b/src/main/java/org/apache/sling/discovery/commons/providers/BaseTopologyView.java index 6464ffc..67127a2 100644 --- a/src/main/java/org/apache/sling/discovery/commons/providers/BaseTopologyView.java +++ b/src/main/java/org/apache/sling/discovery/commons/providers/BaseTopologyView.java @@ -102,4 +102,18 @@ public abstract class BaseTopologyView implements TopologyView { + ", 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; + } + } -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
