added equals() hashCode() methods

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@549883 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2007-06-22 17:12:26 +00:00
parent 955ceceea8
commit 0112df5605
1 changed files with 18 additions and 0 deletions

View File

@ -90,4 +90,22 @@ public class SubscriptionInfo implements DataStructure {
return IntrospectionSupport.toString(this); 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;
}
} }