activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r549883 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/SubscriptionInfo.java
Date Fri, 22 Jun 2007 17:12:27 GMT
Author: rajdavies
Date: Fri Jun 22 10:12:26 2007
New Revision: 549883

URL: http://svn.apache.org/viewvc?view=rev&rev=549883
Log:
added equals() hashCode() methods

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/SubscriptionInfo.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/SubscriptionInfo.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/SubscriptionInfo.java?view=diff&rev=549883&r1=549882&r2=549883
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/SubscriptionInfo.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/SubscriptionInfo.java
Fri Jun 22 10:12:26 2007
@@ -89,5 +89,23 @@
     public String toString() {
         return IntrospectionSupport.toString(this);
     }
+    
+    public int hasCode() {
+        int h1 = clientId != null ? clientId.hashCode():-1;
+        int h2 = subcriptionName != null ? subcriptionName.hashCode():-1;
+        return h1 ^ h2;
+    }
+    
+    public boolean equals(Object obj){
+        boolean result=false;
+        if(obj instanceof SubscriptionInfo){
+            SubscriptionInfo other=(SubscriptionInfo)obj;
+            result=(clientId==null&&other.clientId==null||clientId!=null&&other.clientId!=null
+                    &&clientId.equals(other.clientId))
+                    &&(subcriptionName==null&&other.subcriptionName==null||subcriptionName!=null
+                            &&other.subcriptionName!=null&&subcriptionName.equals(other.subcriptionName));
+        }
+        return result;
+    }
 
 }



Mime
View raw message