feat(nacos): add meta method for instance
@@ -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);
+ }
+
}
