activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject [02/16] git commit: https://issues.apache.org/jira/browse/AMQ-4853
Date Wed, 12 Mar 2014 16:03:28 GMT
https://issues.apache.org/jira/browse/AMQ-4853

Add hashCode and equals override so that this object can be used in
collections properly


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/0e8aa874
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/0e8aa874
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/0e8aa874

Branch: refs/heads/activemq-5.9
Commit: 0e8aa8749a661ca2880882164c1a3c9ad1b8bbfb
Parents: b601e17
Author: Timothy Bish <tabish121@gmai.com>
Authored: Fri Nov 8 16:06:49 2013 -0500
Committer: Hadrian Zbarcea <hadrian@apache.org>
Committed: Wed Mar 12 10:23:46 2014 -0400

----------------------------------------------------------------------
 .../apache/activemq/command/ConsumerInfo.java   | 29 ++++++++++++++++++++
 1 file changed, 29 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/0e8aa874/activemq-client/src/main/java/org/apache/activemq/command/ConsumerInfo.java
----------------------------------------------------------------------
diff --git a/activemq-client/src/main/java/org/apache/activemq/command/ConsumerInfo.java b/activemq-client/src/main/java/org/apache/activemq/command/ConsumerInfo.java
index 3e8ec54..01f2243 100755
--- a/activemq-client/src/main/java/org/apache/activemq/command/ConsumerInfo.java
+++ b/activemq-client/src/main/java/org/apache/activemq/command/ConsumerInfo.java
@@ -114,6 +114,7 @@ public class ConsumerInfo extends BaseCommand {
         return subscriptionName != null;
     }
 
+    @Override
     public byte getDataStructureType() {
         return DATA_STRUCTURE_TYPE;
     }
@@ -343,6 +344,7 @@ public class ConsumerInfo extends BaseCommand {
         this.additionalPredicate = additionalPredicate;
     }
 
+    @Override
     public Response visit(CommandVisitor visitor) throws Exception {
         return visitor.processAddConsumer(this);
     }
@@ -434,6 +436,33 @@ public class ConsumerInfo extends BaseCommand {
         return result;
     }
 
+    @Override
+    public int hashCode() {
+        return (consumerId == null) ? 0 : consumerId.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+
+        ConsumerInfo other = (ConsumerInfo) obj;
+
+        if (consumerId == null && other.consumerId != null) {
+            return false;
+        } else if (!consumerId.equals(other.consumerId)) {
+            return false;
+        }
+        return true;
+    }
+
     /**
      * Tracks the original subscription id that causes a subscription to
      * percolate through a network when networkTTL > 1. Tracking the original


Mime
View raw message