diff --git a/gateway-ha/src/main/java/io/trino/gateway/ha/clustermonitor/ClusterStats.java b/gateway-ha/src/main/java/io/trino/gateway/ha/clustermonitor/ClusterStats.java index f66374c24..4582f4f7f 100644 --- a/gateway-ha/src/main/java/io/trino/gateway/ha/clustermonitor/ClusterStats.java +++ b/gateway-ha/src/main/java/io/trino/gateway/ha/clustermonitor/ClusterStats.java @@ -16,6 +16,8 @@ import java.util.Map; import java.util.Objects; +import static com.google.common.base.MoreObjects.toStringHelper; + public class ClusterStats { private int runningQueryCount; @@ -131,98 +133,48 @@ public void setUserQueuedCount(Map userQueuedCount) this.userQueuedCount = userQueuedCount; } - public boolean equals(final Object o) + @Override + public boolean equals(Object o) { - if (o == this) { + if (this == o) { return true; } - if (!(o instanceof ClusterStats other)) { - return false; - } - if (!other.canEqual(this)) { - return false; - } - if (this.getRunningQueryCount() != other.getRunningQueryCount()) { - return false; - } - if (this.getQueuedQueryCount() != other.getQueuedQueryCount()) { - return false; - } - if (this.getBlockedQueryCount() != other.getBlockedQueryCount()) { - return false; - } - if (this.getNumWorkerNodes() != other.getNumWorkerNodes()) { - return false; - } - if (this.isHealthy() != other.isHealthy()) { - return false; - } - final Object clusterId = this.getClusterId(); - final Object otherClusterId = other.getClusterId(); - if (!Objects.equals(clusterId, otherClusterId)) { - return false; - } - final Object proxyTo = this.getProxyTo(); - final Object otherProxyTo = other.getProxyTo(); - if (!Objects.equals(proxyTo, otherProxyTo)) { - return false; - } - final Object externalUrl = this.getExternalUrl(); - final Object otherExternalUrl = other.getExternalUrl(); - if (!Objects.equals(externalUrl, otherExternalUrl)) { + if (o == null || getClass() != o.getClass()) { return false; } - final Object routingGroup = this.getRoutingGroup(); - final Object otherRoutingGroup = other.getRoutingGroup(); - if (!Objects.equals(routingGroup, otherRoutingGroup)) { - return false; - } - final Object userQueuedCount = this.getUserQueuedCount(); - final Object otherUserQueuedCount = other.getUserQueuedCount(); - return Objects.equals(userQueuedCount, otherUserQueuedCount); - } - - protected boolean canEqual(final Object other) - { - return other instanceof ClusterStats; + ClusterStats stats = (ClusterStats) o; + return runningQueryCount == stats.runningQueryCount && + queuedQueryCount == stats.queuedQueryCount && + blockedQueryCount == stats.blockedQueryCount && + numWorkerNodes == stats.numWorkerNodes && + healthy == stats.healthy && + Objects.equals(clusterId, stats.clusterId) && + Objects.equals(proxyTo, stats.proxyTo) && + Objects.equals(externalUrl, stats.externalUrl) && + Objects.equals(routingGroup, stats.routingGroup) && + Objects.equals(userQueuedCount, stats.userQueuedCount); } + @Override public int hashCode() { - final int prime = 59; - int result = 1; - result = result * prime + this.getRunningQueryCount(); - result = result * prime + this.getQueuedQueryCount(); - result = result * prime + this.getBlockedQueryCount(); - result = result * prime + this.getNumWorkerNodes(); - result = result * prime + (this.isHealthy() ? 79 : 97); - final Object clusterId = this.getClusterId(); - result = result * prime + (clusterId == null ? 43 : clusterId.hashCode()); - final Object proxyTo = this.getProxyTo(); - result = result * prime + (proxyTo == null ? 43 : proxyTo.hashCode()); - final Object externalUrl = this.getExternalUrl(); - result = result * prime + (externalUrl == null ? 43 : externalUrl.hashCode()); - final Object routingGroup = this.getRoutingGroup(); - result = result * prime + (routingGroup == null ? 43 : routingGroup.hashCode()); - final Object userQueuedCount = this.getUserQueuedCount(); - result = result * prime + (userQueuedCount == null ? 43 : userQueuedCount.hashCode()); - return result; + return Objects.hash(runningQueryCount, queuedQueryCount, blockedQueryCount, numWorkerNodes, healthy, clusterId, proxyTo, externalUrl, routingGroup, userQueuedCount); } @Override public String toString() { - return "ClusterStats{" + - "runningQueryCount=" + runningQueryCount + - ", queuedQueryCount=" + queuedQueryCount + - ", blockedQueryCount=" + blockedQueryCount + - ", numWorkerNodes=" + numWorkerNodes + - ", healthy=" + healthy + - ", clusterId='" + clusterId + '\'' + - ", proxyTo='" + proxyTo + '\'' + - ", externalUrl='" + externalUrl + '\'' + - ", routingGroup='" + routingGroup + '\'' + - ", userQueuedCount=" + userQueuedCount + - '}'; + return toStringHelper(this) + .add("runningQueryCount", runningQueryCount) + .add("queuedQueryCount", queuedQueryCount) + .add("blockedQueryCount", blockedQueryCount) + .add("numWorkerNodes", numWorkerNodes) + .add("healthy", healthy) + .add("clusterId", clusterId) + .add("proxyTo", proxyTo) + .add("externalUrl", externalUrl) + .add("routingGroup", routingGroup) + .add("userQueuedCount", userQueuedCount) + .toString(); } } diff --git a/gateway-ha/src/main/java/io/trino/gateway/ha/resource/EntityEditorResource.java b/gateway-ha/src/main/java/io/trino/gateway/ha/resource/EntityEditorResource.java index d4fcebb57..50970e78c 100644 --- a/gateway-ha/src/main/java/io/trino/gateway/ha/resource/EntityEditorResource.java +++ b/gateway-ha/src/main/java/io/trino/gateway/ha/resource/EntityEditorResource.java @@ -44,6 +44,7 @@ import java.util.List; import java.util.Objects; +import static com.google.common.base.MoreObjects.toStringHelper; import static io.trino.gateway.ha.router.ResourceGroupsManager.ResourceGroupsDetail; import static io.trino.gateway.ha.router.ResourceGroupsManager.SelectorsDetail; import static java.util.Objects.requireNonNull; @@ -172,39 +173,31 @@ public void setDisplayName(String displayName) this.displayName = displayName; } - public boolean equals(final Object o) + @Override + public boolean equals(Object o) { - if (o == this) { + if (this == o) { return true; } - if (!(o instanceof EntityView other)) { + if (o == null || getClass() != o.getClass()) { return false; } - if (!other.canEqual(this)) { - return false; - } - final Object displayName = this.getDisplayName(); - final Object otherDisplayName = other.getDisplayName(); - return Objects.equals(displayName, otherDisplayName); - } - - protected boolean canEqual(final Object other) - { - return other instanceof EntityView; + EntityView that = (EntityView) o; + return Objects.equals(displayName, that.displayName); } + @Override public int hashCode() { - final int prime = 59; - int result = 1; - final Object displayName = this.getDisplayName(); - result = result * prime + (displayName == null ? 43 : displayName.hashCode()); - return result; + return Objects.hash(displayName); } + @Override public String toString() { - return "EntityEditorResource.EntityView(displayName=" + this.getDisplayName() + ")"; + return toStringHelper(this) + .add("displayName", displayName) + .toString(); } } } diff --git a/gateway-ha/src/main/java/io/trino/gateway/ha/resource/GatewayViewResource.java b/gateway-ha/src/main/java/io/trino/gateway/ha/resource/GatewayViewResource.java index 2f12d2b0d..3ec3e1d90 100644 --- a/gateway-ha/src/main/java/io/trino/gateway/ha/resource/GatewayViewResource.java +++ b/gateway-ha/src/main/java/io/trino/gateway/ha/resource/GatewayViewResource.java @@ -36,6 +36,7 @@ import java.util.Optional; import java.util.stream.Collectors; +import static com.google.common.base.MoreObjects.toStringHelper; import static java.util.Objects.requireNonNull; @RolesAllowed("USER") @@ -230,78 +231,41 @@ public void setQueryDistribution(Map queryDistribution) this.queryDistribution = queryDistribution; } - public boolean equals(final Object o) + @Override + public boolean equals(Object o) { - if (o == this) { + if (this == o) { return true; } - if (!(o instanceof GatewayView other)) { + if (o == null || getClass() != o.getClass()) { return false; } - if (!other.canEqual(this)) { - return false; - } - if (this.getGatewayStartTime() != other.getGatewayStartTime()) { - return false; - } - final Object displayName = this.getDisplayName(); - final Object otherDisplayName = other.getDisplayName(); - if (!Objects.equals(displayName, otherDisplayName)) { - return false; - } - final Object backendConfigurations = this.getBackendConfigurations(); - final Object otherBackendConfigurations = other.getBackendConfigurations(); - if (!Objects.equals(backendConfigurations, otherBackendConfigurations)) { - return false; - } - final Object queryHistory = this.getQueryHistory(); - final Object otherQueryHistory = other.getQueryHistory(); - if (!Objects.equals(queryHistory, otherQueryHistory)) { - return false; - } - final Object backendStates = this.getBackendStates(); - final Object otherBackendStates = other.getBackendStates(); - if (!Objects.equals(backendStates, otherBackendStates)) { - return false; - } - final Object queryDistribution = this.getQueryDistribution(); - final Object otherQueryDistribution = other.getQueryDistribution(); - return Objects.equals(queryDistribution, otherQueryDistribution); - } - - protected boolean canEqual(final Object other) - { - return other instanceof GatewayView; + GatewayView that = (GatewayView) o; + return gatewayStartTime == that.gatewayStartTime && + Objects.equals(displayName, that.displayName) && + Objects.equals(backendConfigurations, that.backendConfigurations) && + Objects.equals(queryHistory, that.queryHistory) && + Objects.equals(backendStates, that.backendStates) && + Objects.equals(queryDistribution, that.queryDistribution); } + @Override public int hashCode() { - final int prime = 59; - int result = 1; - final long gatewayStartTime = this.getGatewayStartTime(); - result = result * prime + (int) (gatewayStartTime >>> 32 ^ gatewayStartTime); - final Object displayName = this.getDisplayName(); - result = result * prime + (displayName == null ? 43 : displayName.hashCode()); - final Object backendConfigurations = this.getBackendConfigurations(); - result = result * prime + (backendConfigurations == null ? 43 : backendConfigurations.hashCode()); - final Object queryHistory = this.getQueryHistory(); - result = result * prime + (queryHistory == null ? 43 : queryHistory.hashCode()); - final Object backendStates = this.getBackendStates(); - result = result * prime + (backendStates == null ? 43 : backendStates.hashCode()); - final Object queryDistribution = this.getQueryDistribution(); - result = result * prime + (queryDistribution == null ? 43 : queryDistribution.hashCode()); - return result; + return Objects.hash(gatewayStartTime, displayName, backendConfigurations, queryHistory, backendStates, queryDistribution); } + @Override public String toString() { - return "GatewayViewResource.GatewayView(gatewayStartTime=" - + this.getGatewayStartTime() + ", displayName=" - + this.getDisplayName() + ", backendConfigurations=" - + this.getBackendConfigurations() + ", queryHistory=" - + this.getQueryHistory() + ", backendStates=" - + this.getBackendStates() + ", queryDistribution=" - + this.getQueryDistribution() + ")"; + return toStringHelper(this) + .add("gatewayStartTime", gatewayStartTime) + .add("displayName", displayName) + .add("backendConfigurations", backendConfigurations) + .add("queryHistory", queryHistory) + .add("backendStates", backendStates) + .add("queryDistribution", queryDistribution) + .toString(); } } } diff --git a/gateway-ha/src/main/java/io/trino/gateway/ha/router/BackendStateManager.java b/gateway-ha/src/main/java/io/trino/gateway/ha/router/BackendStateManager.java index 3fe7d2621..3957c8fde 100644 --- a/gateway-ha/src/main/java/io/trino/gateway/ha/router/BackendStateManager.java +++ b/gateway-ha/src/main/java/io/trino/gateway/ha/router/BackendStateManager.java @@ -22,6 +22,8 @@ import java.util.Map; import java.util.Objects; +import static com.google.common.base.MoreObjects.toStringHelper; + public class BackendStateManager { @Nullable @@ -76,46 +78,32 @@ public Map getState() return this.state; } - public boolean equals(final Object o) + @Override + public boolean equals(Object o) { - if (o == this) { + if (this == o) { return true; } - if (!(o instanceof BackendState other)) { - return false; - } - if (!other.canEqual(this)) { - return false; - } - final Object name = this.getName(); - final Object otherName = other.getName(); - if (!Objects.equals(name, otherName)) { + if (o == null || getClass() != o.getClass()) { return false; } - final Object state = this.getState(); - final Object otherState = other.getState(); - return Objects.equals(state, otherState); - } - - protected boolean canEqual(final Object other) - { - return other instanceof BackendState; + BackendState that = (BackendState) o; + return Objects.equals(name, that.name) && Objects.equals(state, that.state); } + @Override public int hashCode() { - final int prime = 59; - int result = 1; - final Object name = this.getName(); - result = result * prime + (name == null ? 43 : name.hashCode()); - final Object state = this.getState(); - result = result * prime + (state == null ? 43 : state.hashCode()); - return result; + return Objects.hash(name, state); } + @Override public String toString() { - return "BackendStateManager.BackendState(name=" + this.getName() + ", state=" + this.getState() + ")"; + return toStringHelper(this) + .add("name", name) + .add("state", state) + .toString(); } } } diff --git a/gateway-ha/src/main/java/io/trino/gateway/ha/router/QueryHistoryManager.java b/gateway-ha/src/main/java/io/trino/gateway/ha/router/QueryHistoryManager.java index 75dd5b38c..67317128e 100644 --- a/gateway-ha/src/main/java/io/trino/gateway/ha/router/QueryHistoryManager.java +++ b/gateway-ha/src/main/java/io/trino/gateway/ha/router/QueryHistoryManager.java @@ -17,6 +17,8 @@ import java.util.Objects; import java.util.Optional; +import static com.google.common.base.MoreObjects.toStringHelper; + public interface QueryHistoryManager { void submitQueryDetail(QueryDetail queryDetail); @@ -108,75 +110,41 @@ public void setCaptureTime(long captureTime) this.captureTime = captureTime; } - public boolean equals(final Object o) + @Override + public boolean equals(Object o) { - if (o == this) { + if (this == o) { return true; } - if (!(o instanceof QueryDetail other)) { - return false; - } - if (!other.canEqual(this)) { - return false; - } - final Object queryId = this.getQueryId(); - final Object otherQueryId = other.getQueryId(); - if (!Objects.equals(queryId, otherQueryId)) { - return false; - } - final Object queryText = this.getQueryText(); - final Object otherQueryText = other.getQueryText(); - if (!Objects.equals(queryText, otherQueryText)) { - return false; - } - final Object user = this.getUser(); - final Object otherUser = other.getUser(); - if (!Objects.equals(user, otherUser)) { + if (o == null || getClass() != o.getClass()) { return false; } - final Object source = this.getSource(); - final Object otherSource = other.getSource(); - if (!Objects.equals(source, otherSource)) { - return false; - } - final Object backendUrl = this.getBackendUrl(); - final Object otherBackendUrl = other.getBackendUrl(); - if (!Objects.equals(backendUrl, otherBackendUrl)) { - return false; - } - return this.getCaptureTime() == other.getCaptureTime(); - } - - protected boolean canEqual(final Object other) - { - return other instanceof QueryDetail; + QueryDetail that = (QueryDetail) o; + return captureTime == that.captureTime && + Objects.equals(queryId, that.queryId) && + Objects.equals(queryText, that.queryText) && + Objects.equals(user, that.user) && + Objects.equals(source, that.source) && + Objects.equals(backendUrl, that.backendUrl); } + @Override public int hashCode() { - final int prime = 59; - int result = 1; - final Object queryId = this.getQueryId(); - result = result * prime + (queryId == null ? 43 : queryId.hashCode()); - final Object queryText = this.getQueryText(); - result = result * prime + (queryText == null ? 43 : queryText.hashCode()); - final Object user = this.getUser(); - result = result * prime + (user == null ? 43 : user.hashCode()); - final Object source = this.getSource(); - result = result * prime + (source == null ? 43 : source.hashCode()); - final Object backendUrl = this.getBackendUrl(); - result = result * prime + (backendUrl == null ? 43 : backendUrl.hashCode()); - final long captureTime = this.getCaptureTime(); - result = result * prime + (int) (captureTime >>> 32 ^ captureTime); - return result; + return Objects.hash(queryId, queryText, user, source, backendUrl, captureTime); } + @Override public String toString() { - return "QueryHistoryManager.QueryDetail(queryId=" + this.getQueryId() + ", " + - "queryText=" + this.getQueryText() + ", user=" + this.getUser() + - ", source=" + this.getSource() + ", backendUrl=" + this.getBackendUrl() + - ", captureTime=" + this.getCaptureTime() + ")"; + return toStringHelper(this) + .add("queryId", queryId) + .add("queryText", queryText) + .add("user", user) + .add("source", source) + .add("backendUrl", backendUrl) + .add("captureTime", captureTime) + .toString(); } } } diff --git a/gateway-ha/src/main/java/io/trino/gateway/ha/router/ResourceGroupsManager.java b/gateway-ha/src/main/java/io/trino/gateway/ha/router/ResourceGroupsManager.java index 578f53395..5ccebe919 100644 --- a/gateway-ha/src/main/java/io/trino/gateway/ha/router/ResourceGroupsManager.java +++ b/gateway-ha/src/main/java/io/trino/gateway/ha/router/ResourceGroupsManager.java @@ -19,6 +19,8 @@ import java.util.List; import java.util.Objects; +import static com.google.common.base.MoreObjects.toStringHelper; + public interface ResourceGroupsManager { ResourceGroupsDetail createResourceGroup(ResourceGroupsDetail resourceGroup, @@ -239,121 +241,55 @@ public void setEnvironment(String environment) this.environment = environment; } - public boolean equals(final Object o) + @Override + public boolean equals(Object o) { - if (o == this) { + if (this == o) { return true; } - if (!(o instanceof ResourceGroupsDetail other)) { - return false; - } - if (!other.canEqual(this)) { - return false; - } - if (this.getResourceGroupId() != other.getResourceGroupId()) { - return false; - } - final Object name = this.getName(); - final Object otherName = other.getName(); - if (!Objects.equals(name, otherName)) { - return false; - } - final Object parent = this.getParent(); - final Object otherParent = other.getParent(); - if (!Objects.equals(parent, otherParent)) { - return false; - } - final Object jmxExport = this.getJmxExport(); - final Object otherJmxExport = other.getJmxExport(); - if (!Objects.equals(jmxExport, otherJmxExport)) { - return false; - } - final Object schedulingPolicy = this.getSchedulingPolicy(); - final Object otherSchedulingPolicy = other.getSchedulingPolicy(); - if (!Objects.equals(schedulingPolicy, otherSchedulingPolicy)) { - return false; - } - final Object schedulingWeight = this.getSchedulingWeight(); - final Object otherSchedulingWeight = other.getSchedulingWeight(); - if (!Objects.equals(schedulingWeight, otherSchedulingWeight)) { - return false; - } - final Object softMemoryLimit = this.getSoftMemoryLimit(); - final Object otherSoftMemoryLimit = other.getSoftMemoryLimit(); - if (!Objects.equals(softMemoryLimit, otherSoftMemoryLimit)) { - return false; - } - if (this.getMaxQueued() != other.getMaxQueued()) { + if (o == null || getClass() != o.getClass()) { return false; } - if (this.getHardConcurrencyLimit() != other.getHardConcurrencyLimit()) { - return false; - } - final Object softConcurrencyLimit = this.getSoftConcurrencyLimit(); - final Object otherSoftConcurrencyLimit = other.getSoftConcurrencyLimit(); - if (!Objects.equals(softConcurrencyLimit, otherSoftConcurrencyLimit)) { - return false; - } - final Object softCpuLimit = this.getSoftCpuLimit(); - final Object otherSoftCpuLimit = other.getSoftCpuLimit(); - if (!Objects.equals(softCpuLimit, otherSoftCpuLimit)) { - return false; - } - final Object hardCpuLimit = this.getHardCpuLimit(); - final Object otherHardCpuLimit = other.getHardCpuLimit(); - if (!Objects.equals(hardCpuLimit, otherHardCpuLimit)) { - return false; - } - final Object environment = this.getEnvironment(); - final Object otherEnvironment = other.getEnvironment(); - return Objects.equals(environment, otherEnvironment); - } - - protected boolean canEqual(final Object other) - { - return other instanceof ResourceGroupsDetail; + ResourceGroupsDetail that = (ResourceGroupsDetail) o; + return resourceGroupId == that.resourceGroupId && + maxQueued == that.maxQueued && + hardConcurrencyLimit == that.hardConcurrencyLimit && + Objects.equals(name, that.name) && + Objects.equals(parent, that.parent) && + Objects.equals(jmxExport, that.jmxExport) && + Objects.equals(schedulingPolicy, that.schedulingPolicy) && + Objects.equals(schedulingWeight, that.schedulingWeight) && + Objects.equals(softMemoryLimit, that.softMemoryLimit) && + Objects.equals(softConcurrencyLimit, that.softConcurrencyLimit) && + Objects.equals(softCpuLimit, that.softCpuLimit) && + Objects.equals(hardCpuLimit, that.hardCpuLimit) && + Objects.equals(environment, that.environment); } + @Override public int hashCode() { - final int prime = 59; - int result = 1; - final long resourceGroupId = this.getResourceGroupId(); - result = result * prime + (int) (resourceGroupId >>> 32 ^ resourceGroupId); - final Object name = this.getName(); - result = result * prime + (name == null ? 43 : name.hashCode()); - final Object parent = this.getParent(); - result = result * prime + (parent == null ? 43 : parent.hashCode()); - final Object jmxExport = this.getJmxExport(); - result = result * prime + (jmxExport == null ? 43 : jmxExport.hashCode()); - final Object schedulingPolicy = this.getSchedulingPolicy(); - result = result * prime + (schedulingPolicy == null ? 43 : schedulingPolicy.hashCode()); - final Object schedulingWeight = this.getSchedulingWeight(); - result = result * prime + (schedulingWeight == null ? 43 : schedulingWeight.hashCode()); - final Object softMemoryLimit = this.getSoftMemoryLimit(); - result = result * prime + (softMemoryLimit == null ? 43 : softMemoryLimit.hashCode()); - result = result * prime + this.getMaxQueued(); - result = result * prime + this.getHardConcurrencyLimit(); - final Object softConcurrencyLimit = this.getSoftConcurrencyLimit(); - result = result * prime + (softConcurrencyLimit == null ? 43 : softConcurrencyLimit.hashCode()); - final Object softCpuLimit = this.getSoftCpuLimit(); - result = result * prime + (softCpuLimit == null ? 43 : softCpuLimit.hashCode()); - final Object hardCpuLimit = this.getHardCpuLimit(); - result = result * prime + (hardCpuLimit == null ? 43 : hardCpuLimit.hashCode()); - final Object environment = this.getEnvironment(); - result = result * prime + (environment == null ? 43 : environment.hashCode()); - return result; + return Objects.hash(resourceGroupId, name, parent, jmxExport, schedulingPolicy, schedulingWeight, softMemoryLimit, maxQueued, hardConcurrencyLimit, softConcurrencyLimit, softCpuLimit, hardCpuLimit, environment); } + @Override public String toString() { - return "ResourceGroupsManager.ResourceGroupsDetail(resourceGroupId=" + this.getResourceGroupId() + - ", name=" + this.getName() + ", parent=" + this.getParent() + ", jmxExport=" + this.getJmxExport() + - ", schedulingPolicy=" + this.getSchedulingPolicy() + ", schedulingWeight=" + this.getSchedulingWeight() + - ", softMemoryLimit=" + this.getSoftMemoryLimit() + ", maxQueued=" + this.getMaxQueued() + - ", hardConcurrencyLimit=" + this.getHardConcurrencyLimit() + ", softConcurrencyLimit=" + this.getSoftConcurrencyLimit() + - ", softCpuLimit=" + this.getSoftCpuLimit() + ", hardCpuLimit=" + this.getHardCpuLimit() + - ", environment=" + this.getEnvironment() + ")"; + return toStringHelper(this) + .add("resourceGroupId", resourceGroupId) + .add("name", name) + .add("parent", parent) + .add("jmxExport", jmxExport) + .add("schedulingPolicy", schedulingPolicy) + .add("schedulingWeight", schedulingWeight) + .add("softMemoryLimit", softMemoryLimit) + .add("maxQueued", maxQueued) + .add("hardConcurrencyLimit", hardConcurrencyLimit) + .add("softConcurrencyLimit", softConcurrencyLimit) + .add("softCpuLimit", softCpuLimit) + .add("hardCpuLimit", hardCpuLimit) + .add("environment", environment) + .toString(); } } @@ -459,81 +395,43 @@ public void setSelectorResourceEstimate(String selectorResourceEstimate) this.selectorResourceEstimate = selectorResourceEstimate; } - public boolean equals(final Object o) + @Override + public boolean equals(Object o) { - if (o == this) { + if (this == o) { return true; } - if (!(o instanceof SelectorsDetail other)) { - return false; - } - if (!other.canEqual(this)) { - return false; - } - if (this.getResourceGroupId() != other.getResourceGroupId()) { - return false; - } - if (this.getPriority() != other.getPriority()) { + if (o == null || getClass() != o.getClass()) { return false; } - final Object userRegex = this.getUserRegex(); - final Object otherUserRegex = other.getUserRegex(); - if (!Objects.equals(userRegex, otherUserRegex)) { - return false; - } - final Object sourceRegex = this.getSourceRegex(); - final Object otherSourceRegex = other.getSourceRegex(); - if (!Objects.equals(sourceRegex, otherSourceRegex)) { - return false; - } - final Object queryType = this.getQueryType(); - final Object otherQueryType = other.getQueryType(); - if (!Objects.equals(queryType, otherQueryType)) { - return false; - } - final Object clientTags = this.getClientTags(); - final Object otherClientTags = other.getClientTags(); - if (!Objects.equals(clientTags, otherClientTags)) { - return false; - } - final Object selectorResourceEstimate = this.getSelectorResourceEstimate(); - final Object otherSelectorResourceEstimate = other.getSelectorResourceEstimate(); - return Objects.equals(selectorResourceEstimate, otherSelectorResourceEstimate); - } - - protected boolean canEqual(final Object other) - { - return other instanceof SelectorsDetail; + SelectorsDetail that = (SelectorsDetail) o; + return resourceGroupId == that.resourceGroupId && + priority == that.priority && + Objects.equals(userRegex, that.userRegex) && + Objects.equals(sourceRegex, that.sourceRegex) && + Objects.equals(queryType, that.queryType) && + Objects.equals(clientTags, that.clientTags) && + Objects.equals(selectorResourceEstimate, that.selectorResourceEstimate); } + @Override public int hashCode() { - final int prime = 59; - int result = 1; - final long resourceGroupId = this.getResourceGroupId(); - result = result * prime + (int) (resourceGroupId >>> 32 ^ resourceGroupId); - final long priority = this.getPriority(); - result = result * prime + (int) (priority >>> 32 ^ priority); - final Object userRegex = this.getUserRegex(); - result = result * prime + (userRegex == null ? 43 : userRegex.hashCode()); - final Object sourceRegex = this.getSourceRegex(); - result = result * prime + (sourceRegex == null ? 43 : sourceRegex.hashCode()); - final Object queryType = this.getQueryType(); - result = result * prime + (queryType == null ? 43 : queryType.hashCode()); - final Object clientTags = this.getClientTags(); - result = result * prime + (clientTags == null ? 43 : clientTags.hashCode()); - final Object selectorResourceEstimate = this.getSelectorResourceEstimate(); - result = result * prime + (selectorResourceEstimate == null ? 43 : selectorResourceEstimate.hashCode()); - return result; + return Objects.hash(resourceGroupId, priority, userRegex, sourceRegex, queryType, clientTags, selectorResourceEstimate); } + @Override public String toString() { - return "ResourceGroupsManager.SelectorsDetail(resourceGroupId=" + this.getResourceGroupId() + - ", priority=" + this.getPriority() + ", userRegex=" + this.getUserRegex() + - ", sourceRegex=" + this.getSourceRegex() + ", queryType=" + this.getQueryType() + - ", clientTags=" + this.getClientTags() + - ", selectorResourceEstimate=" + this.getSelectorResourceEstimate() + ")"; + return toStringHelper(this) + .add("resourceGroupId", resourceGroupId) + .add("priority", priority) + .add("userRegex", userRegex) + .add("sourceRegex", sourceRegex) + .add("queryType", queryType) + .add("clientTags", clientTags) + .add("selectorResourceEstimate", selectorResourceEstimate) + .toString(); } } @@ -576,46 +474,32 @@ public void setValue(String value) this.value = value; } - public boolean equals(final Object o) + @Override + public boolean equals(Object o) { - if (o == this) { + if (this == o) { return true; } - if (!(o instanceof GlobalPropertiesDetail other)) { - return false; - } - if (!other.canEqual(this)) { - return false; - } - final Object name = this.getName(); - final Object otherName = other.getName(); - if (!Objects.equals(name, otherName)) { + if (o == null || getClass() != o.getClass()) { return false; } - final Object value = this.getValue(); - final Object otherValue = other.getValue(); - return Objects.equals(value, otherValue); - } - - protected boolean canEqual(final Object other) - { - return other instanceof GlobalPropertiesDetail; + GlobalPropertiesDetail that = (GlobalPropertiesDetail) o; + return Objects.equals(name, that.name) && Objects.equals(value, that.value); } + @Override public int hashCode() { - final int prime = 59; - int result = 1; - final Object name = this.getName(); - result = result * prime + (name == null ? 43 : name.hashCode()); - final Object value = this.getValue(); - result = result * prime + (value == null ? 43 : value.hashCode()); - return result; + return Objects.hash(name, value); } + @Override public String toString() { - return "ResourceGroupsManager.GlobalPropertiesDetail(name=" + this.getName() + ", value=" + this.getValue() + ")"; + return toStringHelper(this) + .add("name", name) + .add("value", value) + .toString(); } } @@ -694,69 +578,39 @@ public void setQueryType(String queryType) this.queryType = queryType; } - public boolean equals(final Object o) + @Override + public boolean equals(Object o) { - if (o == this) { + if (this == o) { return true; } - if (!(o instanceof ExactSelectorsDetail other)) { - return false; - } - if (!other.canEqual(this)) { - return false; - } - final Object resourceGroupId = this.getResourceGroupId(); - final Object otherResourceGroupId = other.getResourceGroupId(); - if (!Objects.equals(resourceGroupId, otherResourceGroupId)) { - return false; - } - final Object updateTime = this.getUpdateTime(); - final Object otherUpdateTime = other.getUpdateTime(); - if (!Objects.equals(updateTime, otherUpdateTime)) { + if (o == null || getClass() != o.getClass()) { return false; } - final Object source = this.getSource(); - final Object otherSource = other.getSource(); - if (!Objects.equals(source, otherSource)) { - return false; - } - final Object environment = this.getEnvironment(); - final Object otherEnvironment = other.getEnvironment(); - if (!Objects.equals(environment, otherEnvironment)) { - return false; - } - final Object queryType = this.getQueryType(); - final Object otherQueryType = other.getQueryType(); - return Objects.equals(queryType, otherQueryType); - } - - protected boolean canEqual(final Object other) - { - return other instanceof ExactSelectorsDetail; + ExactSelectorsDetail that = (ExactSelectorsDetail) o; + return Objects.equals(resourceGroupId, that.resourceGroupId) && + Objects.equals(updateTime, that.updateTime) && + Objects.equals(source, that.source) && + Objects.equals(environment, that.environment) && + Objects.equals(queryType, that.queryType); } + @Override public int hashCode() { - final int prime = 59; - int result = 1; - final Object resourceGroupId = this.getResourceGroupId(); - result = result * prime + (resourceGroupId == null ? 43 : resourceGroupId.hashCode()); - final Object updateTime = this.getUpdateTime(); - result = result * prime + (updateTime == null ? 43 : updateTime.hashCode()); - final Object source = this.getSource(); - result = result * prime + (source == null ? 43 : source.hashCode()); - final Object environment = this.getEnvironment(); - result = result * prime + (environment == null ? 43 : environment.hashCode()); - final Object queryType = this.getQueryType(); - result = result * prime + (queryType == null ? 43 : queryType.hashCode()); - return result; + return Objects.hash(resourceGroupId, updateTime, source, environment, queryType); } + @Override public String toString() { - return "ResourceGroupsManager.ExactSelectorsDetail(resourceGroupId=" + this.getResourceGroupId() + - ", updateTime=" + this.getUpdateTime() + ", source=" + this.getSource() + - ", environment=" + this.getEnvironment() + ", queryType=" + this.getQueryType() + ")"; + return toStringHelper(this) + .add("resourceGroupId", resourceGroupId) + .add("updateTime", updateTime) + .add("source", source) + .add("environment", environment) + .add("queryType", queryType) + .toString(); } } }