Merge pull request #1446 from Nicholas2015/hotfix_subscriber_array_494

Collective data de-duplication
This commit is contained in:
Fury Zhu 2019-06-30 22:35:36 +08:00 committed by GitHub
commit defe701737
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,6 +16,7 @@
package com.alibaba.nacos.naming.pojo;
import java.io.Serializable;
import java.util.Objects;
/**
* @author nicholas
@ -91,4 +92,38 @@ public class Subscriber implements Serializable {
public void setServiceName(String serviceName) {
this.serviceName = serviceName;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Subscriber that = (Subscriber) o;
return Objects.equals(addrStr, that.addrStr) &&
Objects.equals(agent, that.agent) &&
Objects.equals(app, that.app) &&
Objects.equals(ip, that.ip) &&
Objects.equals(namespaceId, that.namespaceId) &&
Objects.equals(serviceName, that.serviceName);
}
@Override
public int hashCode() {
return Objects.hash(addrStr, agent, app, ip, namespaceId, serviceName);
}
@Override
public String toString() {
return "Subscriber{" +
"addrStr='" + addrStr + '\'' +
", agent='" + agent + '\'' +
", app='" + app + '\'' +
", ip='" + ip + '\'' +
", namespaceId='" + namespaceId + '\'' +
", serviceName='" + serviceName + '\'' +
'}';
}
}