add equals&hasCode for PolarisServiceInstance (#773)

pull/795/head
lepdou 2 years ago committed by GitHub
parent d231501dec
commit 012eb0bcc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,4 +17,5 @@
- [Optimize: support delete config for ConfigurationProperties bean ](https://github.com/Tencent/spring-cloud-tencent/pull/756)
- [Feature: support nacos registry](https://github.com/Tencent/spring-cloud-tencent/pull/758)
- [Test:add sct-stater-polaris-router junit.](https://github.com/Tencent/spring-cloud-tencent/pull/768)
- [Optimize: add equals&hasCode for PolarisServiceInstance](https://github.com/Tencent/spring-cloud-tencent/pull/773)
- [Fix issue: prompt no registration if web dependence was not imported.](https://github.com/Tencent/spring-cloud-tencent/pull/778)

@ -19,6 +19,7 @@ package com.tencent.cloud.common.pojo;
import java.net.URI;
import java.util.Map;
import java.util.Objects;
import com.tencent.polaris.api.pojo.Instance;
import org.apache.commons.lang.StringUtils;
@ -89,4 +90,21 @@ public class PolarisServiceInstance implements ServiceInstance {
public String getScheme() {
return this.scheme;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
PolarisServiceInstance that = (PolarisServiceInstance) o;
return Objects.equals(instance, that.instance) && Objects.equals(scheme, that.scheme);
}
@Override
public int hashCode() {
return Objects.hash(instance, scheme);
}
}

Loading…
Cancel
Save