Skip to content

Commit

Permalink
feat(nacos): add meta method for instance
Browse files Browse the repository at this point in the history
  • Loading branch information
MageekChiu authored and steverao committed Jul 25, 2022
1 parent 58795a6 commit 2ff4745
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.net.URI;
import java.util.Map;
import java.util.Objects;

import org.springframework.cloud.client.DefaultServiceInstance;
import org.springframework.cloud.client.ServiceInstance;
Expand Down Expand Up @@ -87,4 +88,27 @@ public void setMetadata(Map<String, String> metadata) {
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);
}

}

0 comments on commit 2ff4745

Please sign in to comment.