You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:24:30 UTC

[sling-org-apache-sling-commons-osgi] 26/29: SLING-1431 : Utility method to get the service ranking - implement equals and hashCode

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

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit e40f3efe85139ea317c6ca93a6f59f040143d68d
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Mar 10 10:50:32 2010 +0000

    SLING-1431 : Utility method to get the service ranking - implement equals and hashCode
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/osgi@921297 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java b/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java
index 88779f1..d571529 100644
--- a/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java
+++ b/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java
@@ -355,5 +355,18 @@ public class OsgiUtil {
             // If ranks are equal, then sort by service id in descending order.
             return (id.compareTo(otherId) < 0) ? 1 : -1;
         }
+
+        @Override
+        public boolean equals(Object obj) {
+            if ( obj instanceof ComparableImplementation ) {
+                return this.props.equals(((ComparableImplementation)obj).props);
+            }
+            return false;
+        }
+
+        @Override
+        public int hashCode() {
+            return this.props.hashCode();
+        }
     }
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.