mirror of https://github.com/apache/activemq.git
Add hashCode and equals override so that this object can be used in collections properly
This commit is contained in:
parent
692428eee5
commit
8f078a3f4c
|
@ -114,6 +114,7 @@ public class ConsumerInfo extends BaseCommand {
|
||||||
return subscriptionName != null;
|
return subscriptionName != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public byte getDataStructureType() {
|
public byte getDataStructureType() {
|
||||||
return DATA_STRUCTURE_TYPE;
|
return DATA_STRUCTURE_TYPE;
|
||||||
}
|
}
|
||||||
|
@ -343,6 +344,7 @@ public class ConsumerInfo extends BaseCommand {
|
||||||
this.additionalPredicate = additionalPredicate;
|
this.additionalPredicate = additionalPredicate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Response visit(CommandVisitor visitor) throws Exception {
|
public Response visit(CommandVisitor visitor) throws Exception {
|
||||||
return visitor.processAddConsumer(this);
|
return visitor.processAddConsumer(this);
|
||||||
}
|
}
|
||||||
|
@ -434,6 +436,33 @@ public class ConsumerInfo extends BaseCommand {
|
||||||
return result;
|
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
|
* Tracks the original subscription id that causes a subscription to
|
||||||
* percolate through a network when networkTTL > 1. Tracking the original
|
* percolate through a network when networkTTL > 1. Tracking the original
|
||||||
|
|
Loading…
Reference in New Issue