feat(nacos): add meta method for instance

pull/2685/head
MageekChiu 3 years ago committed by Steve Rao
parent e536cdd2ef
commit 4265913e51

@ -18,6 +18,7 @@ package com.alibaba.cloud.nacos;
import java.net.URI;
import java.util.Map;
import java.util.Objects;
import org.springframework.cloud.client.DefaultServiceInstance;
import org.springframework.cloud.client.ServiceInstance;
@ -99,4 +100,27 @@ public class NacosServiceInstance implements ServiceInstance {
this.metadata = metadata;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
NacosServiceInstance that = (NacosServiceInstance) o;
return Objects.equals(this.serviceId, that.serviceId)
&& Objects.equals(this.instanceId, that.instanceId)
&& Objects.equals(this.host, that.host)
&& this.port == that.port
&& this.secure == that.secure
&& Objects.equals(this.metadata, that.metadata);
}
@Override
public int hashCode() {
return (instanceId == null) ? 31 : (instanceId.hashCode() + 31);
}
}

Loading…
Cancel
Save