From a4057894dc6506905fd460c2c029107db4d5ea70 Mon Sep 17 00:00:00 2001 From: miguel-vila Date: Thu, 19 Sep 2024 15:10:01 +0100 Subject: [PATCH 01/16] Generate hashCode and equals , wip Signed-off-by: miguel-vila --- .../_types/AcknowledgedResponseBase.java | 14 +++ .../client/opensearch/_types/BaseNode.java | 29 ++++++ .../_types/BulkByScrollFailure.java | 32 +++++++ .../_types/BulkByScrollTaskStatus.java | 76 ++++++++++++++++ .../client/opensearch/_types/ErrorCause.java | 32 +++++++ .../opensearch/_types/NodeStatistics.java | 23 +++++ .../_types/OpenSearchVersionInfo.java | 52 +++++++++++ .../client/opensearch/_types/Retries.java | 17 ++++ .../opensearch/_types/ShardFailure.java | 26 ++++++ .../opensearch/_types/ShardStatistics.java | 26 ++++++ .../client/opensearch/_types/TaskFailure.java | 23 +++++ .../opensearch/_types/WriteResponseBase.java | 36 ++++++++ .../client/opensearch/core/InfoResponse.java | 26 ++++++ .../DeleteDanglingIndexResponse.java | 14 +++ .../ImportDanglingIndexResponse.java | 14 +++ .../ListDanglingIndicesResponse.java | 20 +++++ .../list_dangling_indices/DanglingIndex.java | 26 ++++++ .../ml/DeleteModelGroupResponse.java | 14 +++ .../opensearch/ml/DeleteModelResponse.java | 14 +++ .../opensearch/ml/DeleteTaskResponse.java | 14 +++ .../opensearch/ml/DeployModelResponse.java | 20 +++++ .../opensearch/ml/GetModelGroupResponse.java | 29 ++++++ .../client/opensearch/ml/GetTaskResponse.java | 52 +++++++++++ .../ml/RegisterModelGroupResponse.java | 17 ++++ .../opensearch/ml/RegisterModelResponse.java | 17 ++++ .../opensearch/ml/UndeployModelNode.java | 14 +++ .../opensearch/ml/UndeployModelResponse.java | 14 +++ .../opensearch/tasks/CancelResponse.java | 14 +++ .../opensearch/tasks/GetTasksResponse.java | 23 +++++ .../client/opensearch/tasks/ListResponse.java | 14 +++ .../client/opensearch/tasks/Status.java | 88 +++++++++++++++++++ .../opensearch/tasks/TaskExecutingNode.java | 17 ++++ .../client/opensearch/tasks/TaskGroup.java | 17 ++++ .../client/opensearch/tasks/TaskInfo.java | 64 ++++++++++++++ .../tasks/TaskListResponseBase.java | 23 +++++ .../client/opensearch/tasks/TaskResponse.java | 88 +++++++++++++++++++ .../client/codegen/model/Field.java | 2 + .../codegen/templates/ObjectShape.mustache | 6 +- .../templates/ObjectShape/Equals.mustache | 16 ++++ .../templates/ObjectShape/HashCode.mustache | 10 +++ 40 files changed, 1072 insertions(+), 1 deletion(-) create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/HashCode.mustache diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java index d955102ca7..dac25b5c04 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java @@ -109,4 +109,18 @@ protected static > void setupAcknowle ) { op.add(AbstractBuilder::acknowledged, JsonpDeserializer.booleanDeserializer(), "acknowledged"); } + + public int hashCode() { + return Objects.hash(this.acknowledged); + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + AcknowledgedResponseBase other = (AcknowledgedResponseBase) o; + if (!this.acknowledged().equals(other.acknowledged())) { + return false; + } + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java index 8726abe2e5..990fede143 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java @@ -281,4 +281,33 @@ protected static > void setupBaseNode op.add(AbstractBuilder::roles, JsonpDeserializer.arrayDeserializer(NodeRole._DESERIALIZER), "roles"); op.add(AbstractBuilder::transportAddress, JsonpDeserializer.stringDeserializer(), "transport_address"); } + + public int hashCode() { + return Objects.hash(this.attributes, this.host, this.ip, this.name, this.roles, this.transportAddress); + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + BaseNode other = (BaseNode) o; + if (!this.attributes().equals(other.attributes())) { + return false; + } + if (!this.host().equals(other.host())) { + return false; + } + if (!this.ip().equals(other.ip())) { + return false; + } + if (!this.name().equals(other.name())) { + return false; + } + if (!this.roles().equals(other.roles())) { + return false; + } + if (!this.transportAddress().equals(other.transportAddress())) { + return false; + } + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java index a31cc9741a..d62359cf25 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java @@ -313,4 +313,36 @@ protected static void setupBulkByScrollFailureDeserializer(ObjectDeserializer> void setupWriteRes op.add(AbstractBuilder::shards, ShardStatistics._DESERIALIZER, "_shards"); op.add(AbstractBuilder::version, JsonpDeserializer.longDeserializer(), "_version"); } + + public int hashCode() { + return Objects.hash(this.forcedRefresh, this.id, this.index, this.primaryTerm, this.result, this.seqNo, this.shards, this.version); + } + + public boolean equals(Object o) { + if (this == o) return true; + o. + if (this.getClass() != o.getClass()) return false; + WriteResponseBase other = (WriteResponseBase) o; + if (!this.forcedRefresh().equals(other.forcedRefresh())) { + return false; + } + if (!this.id().equals(other.id())) { + return false; + } + if (!this.index().equals(other.index())) { + return false; + } + if (!this.primaryTerm().equals(other.primaryTerm())) { + return false; + } + if (!this.result().equals(other.result())) { + return false; + } + if (!this.seqNo().equals(other.seqNo())) { + return false; + } + if (!this.shards().equals(other.shards())) { + return false; + } + if (!this.version().equals(other.version())) { + return false; + } + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java index 8f48dfd984..a71f97d1b8 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java @@ -230,4 +230,30 @@ protected static void setupInfoResponseDeserializer(ObjectDeserializer op) { AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); } + + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + DeleteDanglingIndexResponse other = (DeleteDanglingIndexResponse) o; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexResponse.java index eaef581983..87e5d660fb 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexResponse.java @@ -101,4 +101,18 @@ public ImportDanglingIndexResponse build() { protected static void setupImportDanglingIndexResponseDeserializer(ObjectDeserializer op) { AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); } + + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + ImportDanglingIndexResponse other = (ImportDanglingIndexResponse) o; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java index 54acd845ff..7c8f2cb0ef 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java @@ -230,4 +230,24 @@ protected static void setupListDanglingIndicesResponseDeserializer(ObjectDeseria op.add(Builder::danglingIndices, JsonpDeserializer.arrayDeserializer(DanglingIndex._DESERIALIZER), "dangling_indices"); op.add(Builder::nodes, NodeStatistics._DESERIALIZER, "_nodes"); } + + public int hashCode() { + return Objects.hash(this.clusterName, this.danglingIndices, this.nodes); + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + ListDanglingIndicesResponse other = (ListDanglingIndicesResponse) o; + if (!this.clusterName().equals(other.clusterName())) { + return false; + } + if (!this.danglingIndices().equals(other.danglingIndices())) { + return false; + } + if (!this.nodes().equals(other.nodes())) { + return false; + } + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java index c18d275f82..7375d444a6 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java @@ -249,4 +249,30 @@ protected static void setupDanglingIndexDeserializer(ObjectDeserializer op) { WriteResponseBase.setupWriteResponseBaseDeserializer(op); } + + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + DeleteModelGroupResponse other = (DeleteModelGroupResponse) o; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelResponse.java index 1395e93e08..6deb71bcec 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelResponse.java @@ -73,4 +73,18 @@ public DeleteModelResponse build() { protected static void setupDeleteModelResponseDeserializer(ObjectDeserializer op) { WriteResponseBase.setupWriteResponseBaseDeserializer(op); } + + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + DeleteModelResponse other = (DeleteModelResponse) o; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskResponse.java index 93e33ffd2c..e74b1c78e8 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskResponse.java @@ -73,4 +73,18 @@ public DeleteTaskResponse build() { protected static void setupDeleteTaskResponseDeserializer(ObjectDeserializer op) { WriteResponseBase.setupWriteResponseBaseDeserializer(op); } + + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + DeleteTaskResponse other = (DeleteTaskResponse) o; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java index 23b01f8025..e27b2e8ef7 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java @@ -158,4 +158,24 @@ protected static void setupDeployModelResponseDeserializer(ObjectDeserializer op) { op.add(Builder::stats, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "stats"); } + + public int hashCode() { + return Objects.hash(this.stats); + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + UndeployModelNode other = (UndeployModelNode) o; + if (!this.stats().equals(other.stats())) { + return false; + } + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java index 83128a460a..93a0a0171c 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java @@ -140,4 +140,18 @@ protected static void setupUndeployModelResponseDeserializer(ObjectDeserializer< builder.nodes.put(name, UndeployModelNode._DESERIALIZER.deserialize(parser, mapper)); }); } + + public int hashCode() { + return Objects.hash(this.nodes); + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + UndeployModelResponse other = (UndeployModelResponse) o; + if (!this.nodes().equals(other.nodes())) { + return false; + } + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelResponse.java index c8b3e3f539..a4c23bc31b 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelResponse.java @@ -96,4 +96,18 @@ public CancelResponse build() { protected static void setupCancelResponseDeserializer(ObjectDeserializer op) { TaskListResponseBase.setupTaskListResponseBaseDeserializer(op); } + + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + CancelResponse other = (CancelResponse) o; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java index 929d2ebbf0..af2749d759 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java @@ -232,4 +232,27 @@ protected static void setupGetTasksResponseDeserializer(ObjectDeserializer op) { TaskListResponseBase.setupTaskListResponseBaseDeserializer(op); } + + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + ListResponse other = (ListResponse) o; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java index 743796d107..a25b0b2053 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java @@ -767,4 +767,92 @@ protected static void setupStatusDeserializer(ObjectDeserializer builder.metadata.put(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); }); } + + public int hashCode() { + return Objects.hash( + this.batches, + this.canceled, + this.created, + this.deleted, + this.noops, + this.phase, + this.requestsPerSecond, + this.retries, + this.sliceId, + this.slices, + this.state, + this.throttled, + this.throttledMillis, + this.throttledUntil, + this.throttledUntilMillis, + this.total, + this.updated, + this.versionConflicts, + this.metadata + ); + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + Status other = (Status) o; + if (!this.batches().equals(other.batches())) { + return false; + } + if (!this.canceled().equals(other.canceled())) { + return false; + } + if (!this.created().equals(other.created())) { + return false; + } + if (!this.deleted().equals(other.deleted())) { + return false; + } + if (!this.noops().equals(other.noops())) { + return false; + } + if (!this.phase().equals(other.phase())) { + return false; + } + if (!this.requestsPerSecond().equals(other.requestsPerSecond())) { + return false; + } + if (!this.retries().equals(other.retries())) { + return false; + } + if (!this.sliceId().equals(other.sliceId())) { + return false; + } + if (!this.slices().equals(other.slices())) { + return false; + } + if (!this.state().equals(other.state())) { + return false; + } + if (!this.throttled().equals(other.throttled())) { + return false; + } + if (!this.throttledMillis().equals(other.throttledMillis())) { + return false; + } + if (!this.throttledUntil().equals(other.throttledUntil())) { + return false; + } + if (!this.throttledUntilMillis().equals(other.throttledUntilMillis())) { + return false; + } + if (!this.total().equals(other.total())) { + return false; + } + if (!this.updated().equals(other.updated())) { + return false; + } + if (!this.versionConflicts().equals(other.versionConflicts())) { + return false; + } + if (!this.metadata().equals(other.metadata())) { + return false; + } + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java index 3f4c19e178..0cfe87e02c 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java @@ -160,4 +160,21 @@ protected static void setupTaskExecutingNodeDeserializer(ObjectDeserializer> void setupTaskInfo op.add(AbstractBuilder::status, Status._DESERIALIZER, "status"); op.add(AbstractBuilder::type, JsonpDeserializer.stringDeserializer(), "type"); } + + public int hashCode() { + return Objects.hash( + this.action, + this.cancellable, + this.cancelled, + this.description, + this.headers, + this.id, + this.node, + this.parentTaskId, + this.runningTime, + this.runningTimeInNanos, + this.startTimeInMillis, + this.status, + this.type + ); + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + TaskInfo other = (TaskInfo) o; + if (!this.action().equals(other.action())) { + return false; + } + if (!this.cancellable().equals(other.cancellable())) { + return false; + } + if (!this.cancelled().equals(other.cancelled())) { + return false; + } + if (!this.description().equals(other.description())) { + return false; + } + if (!this.headers().equals(other.headers())) { + return false; + } + if (!this.id().equals(other.id())) { + return false; + } + if (!this.node().equals(other.node())) { + return false; + } + if (!this.parentTaskId().equals(other.parentTaskId())) { + return false; + } + if (!this.runningTime().equals(other.runningTime())) { + return false; + } + if (!this.runningTimeInNanos().equals(other.runningTimeInNanos())) { + return false; + } + if (!this.startTimeInMillis().equals(other.startTimeInMillis())) { + return false; + } + if (!this.status().equals(other.status())) { + return false; + } + if (!this.type().equals(other.type())) { + return false; + } + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java index b67eb2965d..51338826a4 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java @@ -306,4 +306,27 @@ protected static > void setupTaskList op.add(AbstractBuilder::taskFailures, JsonpDeserializer.arrayDeserializer(TaskFailure._DESERIALIZER), "task_failures"); op.add(AbstractBuilder::tasks, TaskInfos._DESERIALIZER, "tasks"); } + + public int hashCode() { + return Objects.hash(this.nodeFailures, this.nodes, this.taskFailures, this.tasks); + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + TaskListResponseBase other = (TaskListResponseBase) o; + if (!this.nodeFailures().equals(other.nodeFailures())) { + return false; + } + if (!this.nodes().equals(other.nodes())) { + return false; + } + if (!this.taskFailures().equals(other.taskFailures())) { + return false; + } + if (!this.tasks().equals(other.tasks())) { + return false; + } + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java index 80edbb43d0..b9f1f40869 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java @@ -718,4 +718,92 @@ protected static void setupTaskResponseDeserializer(ObjectDeserializerObjectShape/Deserialize}} -} \ No newline at end of file + + {{>ObjectShape/HashCode}} + + {{>ObjectShape/Equals}} +} diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache new file mode 100644 index 0000000000..1fe124f4e8 --- /dev/null +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache @@ -0,0 +1,16 @@ + public boolean equals(Object o) { + {{#extendsOtherShape}} + if(!super.equals(o)) { + return false; + } + {{/extendsOtherShape}} + if(this == o) return true; + if(this.getClass() != o.getClass()) return false; + {{className}} other = ({{className}})o; + {{#fields}} + if(!this.{{name}}().equals(other.{{name}}())) { + return false; + } + {{/fields}} + return true; + } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/HashCode.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/HashCode.mustache new file mode 100644 index 0000000000..f2d555b7da --- /dev/null +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/HashCode.mustache @@ -0,0 +1,10 @@ + public int hashCode() { + return Objects.hash( +{{#extendsOtherShape}} + super.hashCode(){{#hasFieldsToSerialize}},{{/hasFieldsToSerialize}} +{{/extendsOtherShape}} +{{#fields}} + this.{{name}}{{^-last}},{{/-last}} +{{/fields}} + ); + } From 1c99f144a47f9c647999f20bd15b4e410d3f4d4e Mon Sep 17 00:00:00 2001 From: miguel-vila Date: Thu, 19 Sep 2024 15:15:02 +0100 Subject: [PATCH 02/16] add changelog entry Signed-off-by: miguel-vila --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c56882829..f299533f43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ This section is for maintaining a changelog for all breaking changes for the cli ## [Unreleased 2.x] ### Added +- Add `hashCode` and `equals` implementations ([#312](https://github.com/opensearch-project/opensearch-java/pull/312)). ### Dependencies - Bumps `org.junit:junit-bom` from 5.10.3 to 5.11.0 From 69ba6dd5b7b43315f6106fdde2bfe66da92764f5 Mon Sep 17 00:00:00 2001 From: miguel-vila Date: Thu, 19 Sep 2024 15:20:54 +0100 Subject: [PATCH 03/16] remove change Signed-off-by: miguel-vila --- .../opensearch/client/opensearch/_types/WriteResponseBase.java | 1 - 1 file changed, 1 deletion(-) diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java index 2ff1f0b690..d68ac964ed 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java @@ -284,7 +284,6 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; - o. if (this.getClass() != o.getClass()) return false; WriteResponseBase other = (WriteResponseBase) o; if (!this.forcedRefresh().equals(other.forcedRefresh())) { From 0652c5df1246dead27db1d879a1f18cab75d4fff Mon Sep 17 00:00:00 2001 From: miguel-vila Date: Thu, 19 Sep 2024 17:40:14 +0100 Subject: [PATCH 04/16] take into account primitives Signed-off-by: miguel-vila --- .../_types/AcknowledgedResponseBase.java | 6 +- .../client/opensearch/_types/BaseNode.java | 9 ++- .../_types/BulkByScrollFailure.java | 14 +++- .../_types/BulkByScrollTaskStatus.java | 58 ++++++++-------- .../client/opensearch/_types/ErrorCause.java | 10 ++- .../opensearch/_types/NodeStatistics.java | 13 ++-- .../_types/OpenSearchVersionInfo.java | 26 +++---- .../client/opensearch/_types/Retries.java | 9 ++- .../opensearch/_types/ShardFailure.java | 10 ++- .../opensearch/_types/ShardStatistics.java | 16 +++-- .../client/opensearch/_types/TaskFailure.java | 9 ++- .../opensearch/_types/WriteResponseBase.java | 19 ++++-- .../client/opensearch/core/InfoResponse.java | 8 ++- .../DeleteDanglingIndexResponse.java | 3 +- .../ImportDanglingIndexResponse.java | 3 +- .../ListDanglingIndicesResponse.java | 6 +- .../list_dangling_indices/DanglingIndex.java | 10 ++- .../ml/DeleteModelGroupResponse.java | 3 +- .../opensearch/ml/DeleteModelResponse.java | 3 +- .../opensearch/ml/DeleteTaskResponse.java | 3 +- .../opensearch/ml/DeployModelResponse.java | 6 +- .../opensearch/ml/GetModelGroupResponse.java | 15 ++-- .../client/opensearch/ml/GetTaskResponse.java | 30 ++++---- .../ml/RegisterModelGroupResponse.java | 5 +- .../opensearch/ml/RegisterModelResponse.java | 5 +- .../opensearch/ml/UndeployModelNode.java | 4 +- .../opensearch/ml/UndeployModelResponse.java | 4 +- .../opensearch/tasks/CancelResponse.java | 3 +- .../opensearch/tasks/GetTasksResponse.java | 9 ++- .../client/opensearch/tasks/ListResponse.java | 3 +- .../client/opensearch/tasks/Status.java | 64 ++++++++--------- .../opensearch/tasks/TaskExecutingNode.java | 4 +- .../client/opensearch/tasks/TaskGroup.java | 4 +- .../client/opensearch/tasks/TaskInfo.java | 40 +++++------ .../tasks/TaskListResponseBase.java | 7 +- .../client/opensearch/tasks/TaskResponse.java | 68 +++++++++---------- .../client/codegen/model/Field.java | 10 ++- .../opensearch/client/codegen/model/Type.java | 12 ++++ .../templates/ObjectShape/Equals.mustache | 5 ++ .../templates/ObjectShape/HashCode.mustache | 28 +++++--- 40 files changed, 358 insertions(+), 206 deletions(-) diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java index dac25b5c04..82d74ab1bd 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java @@ -111,14 +111,16 @@ protected static > void setupAcknowle } public int hashCode() { - return Objects.hash(this.acknowledged); + int result = 17; + result = 31 * result + Boolean.hashCode(this.acknowledged); + return result; } public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; AcknowledgedResponseBase other = (AcknowledgedResponseBase) o; - if (!this.acknowledged().equals(other.acknowledged())) { + if (this.acknowledged() != other.acknowledged()) { return false; } return true; diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java index 990fede143..2188835aa5 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java @@ -283,7 +283,14 @@ protected static > void setupBaseNode } public int hashCode() { - return Objects.hash(this.attributes, this.host, this.ip, this.name, this.roles, this.transportAddress); + int result = 17; + result = 31 * result + (attributes != null ? this.attributes.hashCode() : 0); + result = 31 * result + (host != null ? this.host.hashCode() : 0); + result = 31 * result + (ip != null ? this.ip.hashCode() : 0); + result = 31 * result + this.name.hashCode(); + result = 31 * result + (roles != null ? this.roles.hashCode() : 0); + result = 31 * result + (transportAddress != null ? this.transportAddress.hashCode() : 0); + return result; } public boolean equals(Object o) { diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java index d62359cf25..710194717c 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java @@ -315,7 +315,15 @@ protected static void setupBulkByScrollFailureDeserializer(ObjectDeserializer> void setupWriteRes } public int hashCode() { - return Objects.hash(this.forcedRefresh, this.id, this.index, this.primaryTerm, this.result, this.seqNo, this.shards, this.version); + int result = 17; + result = 31 * result + (forcedRefresh != null ? Boolean.hashCode(this.forcedRefresh) : 0); + result = 31 * result + this.id.hashCode(); + result = 31 * result + this.index.hashCode(); + result = 31 * result + Long.hashCode(this.primaryTerm); + result = 31 * result + this.result.hashCode(); + result = 31 * result + Long.hashCode(this.seqNo); + result = 31 * result + this.shards.hashCode(); + result = 31 * result + Long.hashCode(this.version); + return result; } public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; WriteResponseBase other = (WriteResponseBase) o; - if (!this.forcedRefresh().equals(other.forcedRefresh())) { + if (this.forcedRefresh() != other.forcedRefresh()) { return false; } if (!this.id().equals(other.id())) { @@ -295,19 +304,19 @@ public boolean equals(Object o) { if (!this.index().equals(other.index())) { return false; } - if (!this.primaryTerm().equals(other.primaryTerm())) { + if (this.primaryTerm() != other.primaryTerm()) { return false; } if (!this.result().equals(other.result())) { return false; } - if (!this.seqNo().equals(other.seqNo())) { + if (this.seqNo() != other.seqNo()) { return false; } if (!this.shards().equals(other.shards())) { return false; } - if (!this.version().equals(other.version())) { + if (this.version() != other.version()) { return false; } return true; diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java index a71f97d1b8..d2197fcee8 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java @@ -232,7 +232,13 @@ protected static void setupInfoResponseDeserializer(ObjectDeserializer } public int hashCode() { - return Objects.hash( - this.batches, - this.canceled, - this.created, - this.deleted, - this.noops, - this.phase, - this.requestsPerSecond, - this.retries, - this.sliceId, - this.slices, - this.state, - this.throttled, - this.throttledMillis, - this.throttledUntil, - this.throttledUntilMillis, - this.total, - this.updated, - this.versionConflicts, - this.metadata - ); + int result = 17; + result = 31 * result + (batches != null ? Integer.hashCode(this.batches) : 0); + result = 31 * result + (canceled != null ? this.canceled.hashCode() : 0); + result = 31 * result + (created != null ? Long.hashCode(this.created) : 0); + result = 31 * result + (deleted != null ? Long.hashCode(this.deleted) : 0); + result = 31 * result + (noops != null ? Long.hashCode(this.noops) : 0); + result = 31 * result + (phase != null ? this.phase.hashCode() : 0); + result = 31 * result + (requestsPerSecond != null ? Float.hashCode(this.requestsPerSecond) : 0); + result = 31 * result + (retries != null ? this.retries.hashCode() : 0); + result = 31 * result + (sliceId != null ? Integer.hashCode(this.sliceId) : 0); + result = 31 * result + (slices != null ? this.slices.hashCode() : 0); + result = 31 * result + (state != null ? this.state.hashCode() : 0); + result = 31 * result + (throttled != null ? this.throttled.hashCode() : 0); + result = 31 * result + (throttledMillis != null ? Long.hashCode(this.throttledMillis) : 0); + result = 31 * result + (throttledUntil != null ? this.throttledUntil.hashCode() : 0); + result = 31 * result + (throttledUntilMillis != null ? Long.hashCode(this.throttledUntilMillis) : 0); + result = 31 * result + (total != null ? Long.hashCode(this.total) : 0); + result = 31 * result + (updated != null ? Long.hashCode(this.updated) : 0); + result = 31 * result + (versionConflicts != null ? Long.hashCode(this.versionConflicts) : 0); + result = 31 * result + (metadata != null ? this.metadata.hashCode() : 0); + return result; } public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; Status other = (Status) o; - if (!this.batches().equals(other.batches())) { + if (this.batches() != other.batches()) { return false; } if (!this.canceled().equals(other.canceled())) { return false; } - if (!this.created().equals(other.created())) { + if (this.created() != other.created()) { return false; } - if (!this.deleted().equals(other.deleted())) { + if (this.deleted() != other.deleted()) { return false; } - if (!this.noops().equals(other.noops())) { + if (this.noops() != other.noops()) { return false; } if (!this.phase().equals(other.phase())) { return false; } - if (!this.requestsPerSecond().equals(other.requestsPerSecond())) { + if (this.requestsPerSecond() != other.requestsPerSecond()) { return false; } if (!this.retries().equals(other.retries())) { return false; } - if (!this.sliceId().equals(other.sliceId())) { + if (this.sliceId() != other.sliceId()) { return false; } if (!this.slices().equals(other.slices())) { @@ -832,22 +832,22 @@ public boolean equals(Object o) { if (!this.throttled().equals(other.throttled())) { return false; } - if (!this.throttledMillis().equals(other.throttledMillis())) { + if (this.throttledMillis() != other.throttledMillis()) { return false; } if (!this.throttledUntil().equals(other.throttledUntil())) { return false; } - if (!this.throttledUntilMillis().equals(other.throttledUntilMillis())) { + if (this.throttledUntilMillis() != other.throttledUntilMillis()) { return false; } - if (!this.total().equals(other.total())) { + if (this.total() != other.total()) { return false; } - if (!this.updated().equals(other.updated())) { + if (this.updated() != other.updated()) { return false; } - if (!this.versionConflicts().equals(other.versionConflicts())) { + if (this.versionConflicts() != other.versionConflicts()) { return false; } if (!this.metadata().equals(other.metadata())) { diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java index 0cfe87e02c..5b801bc859 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java @@ -162,7 +162,9 @@ protected static void setupTaskExecutingNodeDeserializer(ObjectDeserializer> void setupTaskInfo } public int hashCode() { - return Objects.hash( - this.action, - this.cancellable, - this.cancelled, - this.description, - this.headers, - this.id, - this.node, - this.parentTaskId, - this.runningTime, - this.runningTimeInNanos, - this.startTimeInMillis, - this.status, - this.type - ); + int result = 17; + result = 31 * result + this.action.hashCode(); + result = 31 * result + Boolean.hashCode(this.cancellable); + result = 31 * result + (cancelled != null ? Boolean.hashCode(this.cancelled) : 0); + result = 31 * result + (description != null ? this.description.hashCode() : 0); + result = 31 * result + this.headers.hashCode(); + result = 31 * result + Long.hashCode(this.id); + result = 31 * result + this.node.hashCode(); + result = 31 * result + (parentTaskId != null ? this.parentTaskId.hashCode() : 0); + result = 31 * result + (runningTime != null ? this.runningTime.hashCode() : 0); + result = 31 * result + Long.hashCode(this.runningTimeInNanos); + result = 31 * result + Long.hashCode(this.startTimeInMillis); + result = 31 * result + (status != null ? this.status.hashCode() : 0); + result = 31 * result + this.type.hashCode(); + return result; } public boolean equals(Object o) { @@ -504,10 +504,10 @@ public boolean equals(Object o) { if (!this.action().equals(other.action())) { return false; } - if (!this.cancellable().equals(other.cancellable())) { + if (this.cancellable() != other.cancellable()) { return false; } - if (!this.cancelled().equals(other.cancelled())) { + if (this.cancelled() != other.cancelled()) { return false; } if (!this.description().equals(other.description())) { @@ -516,7 +516,7 @@ public boolean equals(Object o) { if (!this.headers().equals(other.headers())) { return false; } - if (!this.id().equals(other.id())) { + if (this.id() != other.id()) { return false; } if (!this.node().equals(other.node())) { @@ -528,10 +528,10 @@ public boolean equals(Object o) { if (!this.runningTime().equals(other.runningTime())) { return false; } - if (!this.runningTimeInNanos().equals(other.runningTimeInNanos())) { + if (this.runningTimeInNanos() != other.runningTimeInNanos()) { return false; } - if (!this.startTimeInMillis().equals(other.startTimeInMillis())) { + if (this.startTimeInMillis() != other.startTimeInMillis()) { return false; } if (!this.status().equals(other.status())) { diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java index 51338826a4..004b0612ab 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java @@ -308,7 +308,12 @@ protected static > void setupTaskList } public int hashCode() { - return Objects.hash(this.nodeFailures, this.nodes, this.taskFailures, this.tasks); + int result = 17; + result = 31 * result + (nodeFailures != null ? this.nodeFailures.hashCode() : 0); + result = 31 * result + (nodes != null ? this.nodes.hashCode() : 0); + result = 31 * result + (taskFailures != null ? this.taskFailures.hashCode() : 0); + result = 31 * result + (tasks != null ? this.tasks.hashCode() : 0); + return result; } public boolean equals(Object o) { diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java index b9f1f40869..1f9b8f0276 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java @@ -720,58 +720,58 @@ protected static void setupTaskResponseDeserializer(ObjectDeserializer Date: Thu, 19 Sep 2024 17:48:28 +0100 Subject: [PATCH 05/16] refactor and format Signed-off-by: miguel-vila --- .../_types/BulkByScrollFailure.java | 2 +- .../_types/BulkByScrollTaskStatus.java | 6 ++--- .../opensearch/_types/ShardStatistics.java | 2 +- .../opensearch/_types/WriteResponseBase.java | 2 +- .../opensearch/ml/GetModelGroupResponse.java | 4 +-- .../client/opensearch/ml/GetTaskResponse.java | 6 ++--- .../client/opensearch/tasks/Status.java | 22 +++++++-------- .../client/opensearch/tasks/TaskInfo.java | 2 +- .../client/opensearch/tasks/TaskResponse.java | 6 ++--- .../templates/ObjectShape/Equals.mustache | 22 +++++++-------- .../templates/ObjectShape/HashCode.mustache | 27 ++++++++----------- 11 files changed, 48 insertions(+), 53 deletions(-) diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java index 710194717c..1ff170f5c6 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java @@ -321,7 +321,7 @@ public int hashCode() { result = 31 * result + (index != null ? this.index.hashCode() : 0); result = 31 * result + (node != null ? this.node.hashCode() : 0); result = 31 * result + (reason != null ? this.reason.hashCode() : 0); - result = 31 * result + (shard != null ? Integer.hashCode(this.shard) : 0); + result = 31 * result + Integer.hashCode(this.shard); result = 31 * result + Integer.hashCode(this.status); return result; } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatus.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatus.java index 5195b1c36e..94a6e8d056 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatus.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatus.java @@ -619,19 +619,19 @@ public int hashCode() { int result = 17; result = 31 * result + Integer.hashCode(this.batches); result = 31 * result + (canceled != null ? this.canceled.hashCode() : 0); - result = 31 * result + (created != null ? Long.hashCode(this.created) : 0); + result = 31 * result + Long.hashCode(this.created); result = 31 * result + Long.hashCode(this.deleted); result = 31 * result + Long.hashCode(this.noops); result = 31 * result + Float.hashCode(this.requestsPerSecond); result = 31 * result + this.retries.hashCode(); - result = 31 * result + (sliceId != null ? Integer.hashCode(this.sliceId) : 0); + result = 31 * result + Integer.hashCode(this.sliceId); result = 31 * result + (slices != null ? this.slices.hashCode() : 0); result = 31 * result + (throttled != null ? this.throttled.hashCode() : 0); result = 31 * result + Long.hashCode(this.throttledMillis); result = 31 * result + (throttledUntil != null ? this.throttledUntil.hashCode() : 0); result = 31 * result + Long.hashCode(this.throttledUntilMillis); result = 31 * result + Long.hashCode(this.total); - result = 31 * result + (updated != null ? Long.hashCode(this.updated) : 0); + result = 31 * result + Long.hashCode(this.updated); result = 31 * result + Long.hashCode(this.versionConflicts); return result; } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java index 4b0c7a5c05..2b0bf6824c 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java @@ -268,7 +268,7 @@ public int hashCode() { int result = 17; result = 31 * result + Integer.hashCode(this.failed); result = 31 * result + (failures != null ? this.failures.hashCode() : 0); - result = 31 * result + (skipped != null ? Integer.hashCode(this.skipped) : 0); + result = 31 * result + Integer.hashCode(this.skipped); result = 31 * result + Integer.hashCode(this.successful); result = 31 * result + Integer.hashCode(this.total); return result; diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java index 2fe1a05b0e..af01e277e5 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java @@ -280,7 +280,7 @@ protected static > void setupWriteRes public int hashCode() { int result = 17; - result = 31 * result + (forcedRefresh != null ? Boolean.hashCode(this.forcedRefresh) : 0); + result = 31 * result + Boolean.hashCode(this.forcedRefresh); result = 31 * result + this.id.hashCode(); result = 31 * result + this.index.hashCode(); result = 31 * result + Long.hashCode(this.primaryTerm); diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java index 3190a1b55c..25334bcb51 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java @@ -260,9 +260,9 @@ protected static void setupGetModelGroupResponseDeserializer(ObjectDeserializer< public int hashCode() { int result = 17; result = 31 * result + this.access.hashCode(); - result = 31 * result + (createdTime != null ? Long.hashCode(this.createdTime) : 0); + result = 31 * result + Long.hashCode(this.createdTime); result = 31 * result + this.description.hashCode(); - result = 31 * result + (lastUpdatedTime != null ? Long.hashCode(this.lastUpdatedTime) : 0); + result = 31 * result + Long.hashCode(this.lastUpdatedTime); result = 31 * result + Integer.hashCode(this.latestVersion); result = 31 * result + this.name.hashCode(); return result; diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java index 07ce62313e..3ee8d07576 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java @@ -395,11 +395,11 @@ protected static void setupGetTaskResponseDeserializer(ObjectDeserializer public int hashCode() { int result = 17; - result = 31 * result + (batches != null ? Integer.hashCode(this.batches) : 0); + result = 31 * result + Integer.hashCode(this.batches); result = 31 * result + (canceled != null ? this.canceled.hashCode() : 0); - result = 31 * result + (created != null ? Long.hashCode(this.created) : 0); - result = 31 * result + (deleted != null ? Long.hashCode(this.deleted) : 0); - result = 31 * result + (noops != null ? Long.hashCode(this.noops) : 0); + result = 31 * result + Long.hashCode(this.created); + result = 31 * result + Long.hashCode(this.deleted); + result = 31 * result + Long.hashCode(this.noops); result = 31 * result + (phase != null ? this.phase.hashCode() : 0); - result = 31 * result + (requestsPerSecond != null ? Float.hashCode(this.requestsPerSecond) : 0); + result = 31 * result + Float.hashCode(this.requestsPerSecond); result = 31 * result + (retries != null ? this.retries.hashCode() : 0); - result = 31 * result + (sliceId != null ? Integer.hashCode(this.sliceId) : 0); + result = 31 * result + Integer.hashCode(this.sliceId); result = 31 * result + (slices != null ? this.slices.hashCode() : 0); result = 31 * result + (state != null ? this.state.hashCode() : 0); result = 31 * result + (throttled != null ? this.throttled.hashCode() : 0); - result = 31 * result + (throttledMillis != null ? Long.hashCode(this.throttledMillis) : 0); + result = 31 * result + Long.hashCode(this.throttledMillis); result = 31 * result + (throttledUntil != null ? this.throttledUntil.hashCode() : 0); - result = 31 * result + (throttledUntilMillis != null ? Long.hashCode(this.throttledUntilMillis) : 0); - result = 31 * result + (total != null ? Long.hashCode(this.total) : 0); - result = 31 * result + (updated != null ? Long.hashCode(this.updated) : 0); - result = 31 * result + (versionConflicts != null ? Long.hashCode(this.versionConflicts) : 0); + result = 31 * result + Long.hashCode(this.throttledUntilMillis); + result = 31 * result + Long.hashCode(this.total); + result = 31 * result + Long.hashCode(this.updated); + result = 31 * result + Long.hashCode(this.versionConflicts); result = 31 * result + (metadata != null ? this.metadata.hashCode() : 0); return result; } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfo.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfo.java index b3d31ff369..e5ffef3f56 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfo.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfo.java @@ -483,7 +483,7 @@ public int hashCode() { int result = 17; result = 31 * result + this.action.hashCode(); result = 31 * result + Boolean.hashCode(this.cancellable); - result = 31 * result + (cancelled != null ? Boolean.hashCode(this.cancelled) : 0); + result = 31 * result + Boolean.hashCode(this.cancelled); result = 31 * result + (description != null ? this.description.hashCode() : 0); result = 31 * result + this.headers.hashCode(); result = 31 * result + Long.hashCode(this.id); diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java index 1f9b8f0276..6677e33529 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java @@ -723,13 +723,13 @@ public int hashCode() { int result = 17; result = 31 * result + Integer.hashCode(this.batches); result = 31 * result + (canceled != null ? this.canceled.hashCode() : 0); - result = 31 * result + (created != null ? Long.hashCode(this.created) : 0); + result = 31 * result + Long.hashCode(this.created); result = 31 * result + Long.hashCode(this.deleted); result = 31 * result + this.failures.hashCode(); result = 31 * result + Long.hashCode(this.noops); result = 31 * result + Float.hashCode(this.requestsPerSecond); result = 31 * result + this.retries.hashCode(); - result = 31 * result + (sliceId != null ? Integer.hashCode(this.sliceId) : 0); + result = 31 * result + Integer.hashCode(this.sliceId); result = 31 * result + (slices != null ? this.slices.hashCode() : 0); result = 31 * result + (throttled != null ? this.throttled.hashCode() : 0); result = 31 * result + Long.hashCode(this.throttledMillis); @@ -738,7 +738,7 @@ public int hashCode() { result = 31 * result + Boolean.hashCode(this.timedOut); result = 31 * result + Long.hashCode(this.took); result = 31 * result + Long.hashCode(this.total); - result = 31 * result + (updated != null ? Long.hashCode(this.updated) : 0); + result = 31 * result + Long.hashCode(this.updated); result = 31 * result + Long.hashCode(this.versionConflicts); return result; } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache index e97da51a09..07e17de128 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache @@ -1,21 +1,21 @@ public boolean equals(Object o) { {{#extendsOtherShape}} - if(!super.equals(o)) { - return false; - } + if(!super.equals(o)) { + return false; + } {{/extendsOtherShape}} if(this == o) return true; if(this.getClass() != o.getClass()) return false; {{className}} other = ({{className}})o; {{#fields}} - {{#isUnboxedPrimitive}} - if(this.{{name}}() != other.{{name}}()) { - {{/isUnboxedPrimitive}} - {{^isUnboxedPrimitive}} - if(!this.{{name}}().equals(other.{{name}}())) { - {{/isUnboxedPrimitive}} - return false; - } + {{#isUnboxedPrimitive}} + if(this.{{name}}() != other.{{name}}()) { + {{/isUnboxedPrimitive}} + {{^isUnboxedPrimitive}} + if(!this.{{name}}().equals(other.{{name}}())) { + {{/isUnboxedPrimitive}} + return false; + } {{/fields}} return true; } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/HashCode.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/HashCode.mustache index 40ce61cb13..a80908c42d 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/HashCode.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/HashCode.mustache @@ -1,22 +1,17 @@ public int hashCode() { int result = 17; {{#fields}} - {{#isRequired}} - {{^isUnboxedPrimitive}} - result = 31 * result + this.{{name}}.hashCode(); - {{/isUnboxedPrimitive}} - {{#isUnboxedPrimitive}} - result = 31 * result + {{getBoxedType}}.hashCode(this.{{name}}); - {{/isUnboxedPrimitive}} - {{/isRequired}} - {{^isRequired}} - {{^isUnboxedPrimitive}} - result = 31 * result + ({{name}} != null ? this.{{name}}.hashCode() : 0); - {{/isUnboxedPrimitive}} - {{#isUnboxedPrimitive}} - result = 31 * result + ({{name}} != null ? {{getBoxedType}}.hashCode(this.{{name}}) : 0); - {{/isUnboxedPrimitive}} - {{/isRequired}} + {{#isUnboxedPrimitive}} + result = 31 * result + {{getBoxedType}}.hashCode(this.{{name}}); + {{/isUnboxedPrimitive}} + {{^isUnboxedPrimitive}} + {{#isRequired}} + result = 31 * result + this.{{name}}.hashCode(); + {{/isRequired}} + {{^isRequired}} + result = 31 * result + ({{name}} != null ? this.{{name}}.hashCode() : 0); + {{/isRequired}} + {{/isUnboxedPrimitive}} {{/fields}} return result; } From 93edabe04e4c76fe27107768bf62b649210ec898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Vil=C3=A1?= Date: Fri, 20 Sep 2024 10:10:39 +0100 Subject: [PATCH 06/16] use Object.equals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Thomas Farr Signed-off-by: Miguel Vilá --- .../client/codegen/templates/ObjectShape/Equals.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache index 07e17de128..70ea7234d8 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache @@ -12,7 +12,7 @@ if(this.{{name}}() != other.{{name}}()) { {{/isUnboxedPrimitive}} {{^isUnboxedPrimitive}} - if(!this.{{name}}().equals(other.{{name}}())) { + if(!Objects.equals(this.{{name}}, other.{{name}})) { {{/isUnboxedPrimitive}} return false; } From 8a150f31e2ea4a60f2ebdc48ecadefd6d592108f Mon Sep 17 00:00:00 2001 From: miguel-vila Date: Fri, 20 Sep 2024 10:34:59 +0100 Subject: [PATCH 07/16] use `&&` chain Signed-off-by: miguel-vila --- .../_types/AcknowledgedResponseBase.java | 7 +- .../client/opensearch/_types/BaseNode.java | 27 ++----- .../_types/BulkByScrollFailure.java | 31 +++----- .../_types/BulkByScrollTaskStatus.java | 67 +++++----------- .../client/opensearch/_types/ErrorCause.java | 31 +++----- .../opensearch/_types/NodeStatistics.java | 19 ++--- .../_types/OpenSearchVersionInfo.java | 45 ++++------- .../client/opensearch/_types/Retries.java | 10 +-- .../opensearch/_types/ShardFailure.java | 23 ++---- .../opensearch/_types/ShardStatistics.java | 23 ++---- .../client/opensearch/_types/TaskFailure.java | 19 ++--- .../opensearch/_types/WriteResponseBase.java | 35 +++----- .../client/opensearch/core/InfoResponse.java | 23 ++---- .../ListDanglingIndicesResponse.java | 15 ++-- .../list_dangling_indices/DanglingIndex.java | 23 ++---- .../opensearch/ml/DeployModelResponse.java | 15 ++-- .../opensearch/ml/GetModelGroupResponse.java | 27 ++----- .../client/opensearch/ml/GetTaskResponse.java | 43 +++------- .../ml/RegisterModelGroupResponse.java | 11 +-- .../opensearch/ml/RegisterModelResponse.java | 10 +-- .../opensearch/ml/UndeployModelNode.java | 7 +- .../opensearch/ml/UndeployModelResponse.java | 7 +- .../opensearch/tasks/GetTasksResponse.java | 19 ++--- .../client/opensearch/tasks/Status.java | 79 +++++-------------- .../opensearch/tasks/TaskExecutingNode.java | 7 +- .../client/opensearch/tasks/TaskGroup.java | 7 +- .../client/opensearch/tasks/TaskInfo.java | 55 ++++--------- .../tasks/TaskListResponseBase.java | 19 ++--- .../client/opensearch/tasks/TaskResponse.java | 79 +++++-------------- .../templates/ObjectShape/Equals.mustache | 12 ++- 30 files changed, 237 insertions(+), 558 deletions(-) diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java index 82d74ab1bd..617cc546d2 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java @@ -120,9 +120,8 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; AcknowledgedResponseBase other = (AcknowledgedResponseBase) o; - if (this.acknowledged() != other.acknowledged()) { - return false; - } - return true; + return this.acknowledged() == other.acknowledged() + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java index 2188835aa5..c0e222b6ec 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java @@ -297,24 +297,13 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; BaseNode other = (BaseNode) o; - if (!this.attributes().equals(other.attributes())) { - return false; - } - if (!this.host().equals(other.host())) { - return false; - } - if (!this.ip().equals(other.ip())) { - return false; - } - if (!this.name().equals(other.name())) { - return false; - } - if (!this.roles().equals(other.roles())) { - return false; - } - if (!this.transportAddress().equals(other.transportAddress())) { - return false; - } - return true; + return (this.attributes != null && this.attributes.equals(other.attributes)) + && (this.host != null && this.host.equals(other.host)) + && (this.ip != null && this.ip.equals(other.ip)) + && (this.name != null && this.name.equals(other.name)) + && (this.roles != null && this.roles.equals(other.roles)) + && (this.transportAddress != null && this.transportAddress.equals(other.transportAddress)) + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java index 1ff170f5c6..a5593e00be 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java @@ -330,27 +330,14 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; BulkByScrollFailure other = (BulkByScrollFailure) o; - if (!this.cause().equals(other.cause())) { - return false; - } - if (!this.id().equals(other.id())) { - return false; - } - if (!this.index().equals(other.index())) { - return false; - } - if (!this.node().equals(other.node())) { - return false; - } - if (!this.reason().equals(other.reason())) { - return false; - } - if (this.shard() != other.shard()) { - return false; - } - if (this.status() != other.status()) { - return false; - } - return true; + return (this.cause != null && this.cause.equals(other.cause)) + && (this.id != null && this.id.equals(other.id)) + && (this.index != null && this.index.equals(other.index)) + && (this.node != null && this.node.equals(other.node)) + && (this.reason != null && this.reason.equals(other.reason)) + && this.shard() == other.shard() + && this.status() == other.status() + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatus.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatus.java index 94a6e8d056..dac7ec447e 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatus.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatus.java @@ -640,54 +640,23 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; BulkByScrollTaskStatus other = (BulkByScrollTaskStatus) o; - if (this.batches() != other.batches()) { - return false; - } - if (!this.canceled().equals(other.canceled())) { - return false; - } - if (this.created() != other.created()) { - return false; - } - if (this.deleted() != other.deleted()) { - return false; - } - if (this.noops() != other.noops()) { - return false; - } - if (this.requestsPerSecond() != other.requestsPerSecond()) { - return false; - } - if (!this.retries().equals(other.retries())) { - return false; - } - if (this.sliceId() != other.sliceId()) { - return false; - } - if (!this.slices().equals(other.slices())) { - return false; - } - if (!this.throttled().equals(other.throttled())) { - return false; - } - if (this.throttledMillis() != other.throttledMillis()) { - return false; - } - if (!this.throttledUntil().equals(other.throttledUntil())) { - return false; - } - if (this.throttledUntilMillis() != other.throttledUntilMillis()) { - return false; - } - if (this.total() != other.total()) { - return false; - } - if (this.updated() != other.updated()) { - return false; - } - if (this.versionConflicts() != other.versionConflicts()) { - return false; - } - return true; + return this.batches() == other.batches() + && (this.canceled != null && this.canceled.equals(other.canceled)) + && this.created() == other.created() + && this.deleted() == other.deleted() + && this.noops() == other.noops() + && this.requestsPerSecond() == other.requestsPerSecond() + && (this.retries != null && this.retries.equals(other.retries)) + && this.sliceId() == other.sliceId() + && (this.slices != null && this.slices.equals(other.slices)) + && (this.throttled != null && this.throttled.equals(other.throttled)) + && this.throttledMillis() == other.throttledMillis() + && (this.throttledUntil != null && this.throttledUntil.equals(other.throttledUntil)) + && this.throttledUntilMillis() == other.throttledUntilMillis() + && this.total() == other.total() + && this.updated() == other.updated() + && this.versionConflicts() == other.versionConflicts() + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java index 79ab9bf636..05753a914d 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java @@ -421,27 +421,14 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; ErrorCause other = (ErrorCause) o; - if (!this.causedBy().equals(other.causedBy())) { - return false; - } - if (!this.reason().equals(other.reason())) { - return false; - } - if (!this.rootCause().equals(other.rootCause())) { - return false; - } - if (!this.stackTrace().equals(other.stackTrace())) { - return false; - } - if (!this.suppressed().equals(other.suppressed())) { - return false; - } - if (!this.type().equals(other.type())) { - return false; - } - if (!this.metadata().equals(other.metadata())) { - return false; - } - return true; + return (this.causedBy != null && this.causedBy.equals(other.causedBy)) + && (this.reason != null && this.reason.equals(other.reason)) + && (this.rootCause != null && this.rootCause.equals(other.rootCause)) + && (this.stackTrace != null && this.stackTrace.equals(other.stackTrace)) + && (this.suppressed != null && this.suppressed.equals(other.suppressed)) + && (this.type != null && this.type.equals(other.type)) + && (this.metadata != null && this.metadata.equals(other.metadata)) + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java index b1e8743a57..4870dea3b9 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java @@ -269,18 +269,11 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; NodeStatistics other = (NodeStatistics) o; - if (this.failed() != other.failed()) { - return false; - } - if (!this.failures().equals(other.failures())) { - return false; - } - if (this.successful() != other.successful()) { - return false; - } - if (this.total() != other.total()) { - return false; - } - return true; + return this.failed() == other.failed() + && (this.failures != null && this.failures.equals(other.failures)) + && this.successful() == other.successful() + && this.total() == other.total() + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java index 31a58d07bd..329fec29ed 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java @@ -371,36 +371,19 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; OpenSearchVersionInfo other = (OpenSearchVersionInfo) o; - if (!this.buildDate().equals(other.buildDate())) { - return false; - } - if (!this.buildFlavor().equals(other.buildFlavor())) { - return false; - } - if (!this.buildHash().equals(other.buildHash())) { - return false; - } - if (this.buildSnapshot() != other.buildSnapshot()) { - return false; - } - if (!this.buildType().equals(other.buildType())) { - return false; - } - if (!this.distribution().equals(other.distribution())) { - return false; - } - if (!this.luceneVersion().equals(other.luceneVersion())) { - return false; - } - if (!this.minimumIndexCompatibilityVersion().equals(other.minimumIndexCompatibilityVersion())) { - return false; - } - if (!this.minimumWireCompatibilityVersion().equals(other.minimumWireCompatibilityVersion())) { - return false; - } - if (!this.number().equals(other.number())) { - return false; - } - return true; + return (this.buildDate != null && this.buildDate.equals(other.buildDate)) + && (this.buildFlavor != null && this.buildFlavor.equals(other.buildFlavor)) + && (this.buildHash != null && this.buildHash.equals(other.buildHash)) + && this.buildSnapshot() == other.buildSnapshot() + && (this.buildType != null && this.buildType.equals(other.buildType)) + && (this.distribution != null && this.distribution.equals(other.distribution)) + && (this.luceneVersion != null && this.luceneVersion.equals(other.luceneVersion)) + && (this.minimumIndexCompatibilityVersion != null + && this.minimumIndexCompatibilityVersion.equals(other.minimumIndexCompatibilityVersion)) + && (this.minimumWireCompatibilityVersion != null + && this.minimumWireCompatibilityVersion.equals(other.minimumWireCompatibilityVersion)) + && (this.number != null && this.number.equals(other.number)) + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Retries.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Retries.java index 6dceb6ab02..5d77839f32 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Retries.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Retries.java @@ -165,12 +165,8 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; Retries other = (Retries) o; - if (this.bulk() != other.bulk()) { - return false; - } - if (this.search() != other.search()) { - return false; - } - return true; + return this.bulk() == other.bulk() && this.search() == other.search() + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java index b20ee0a412..26dd7bdd7e 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java @@ -260,21 +260,12 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; ShardFailure other = (ShardFailure) o; - if (!this.index().equals(other.index())) { - return false; - } - if (!this.node().equals(other.node())) { - return false; - } - if (!this.reason().equals(other.reason())) { - return false; - } - if (this.shard() != other.shard()) { - return false; - } - if (!this.status().equals(other.status())) { - return false; - } - return true; + return (this.index != null && this.index.equals(other.index)) + && (this.node != null && this.node.equals(other.node)) + && (this.reason != null && this.reason.equals(other.reason)) + && this.shard() == other.shard() + && (this.status != null && this.status.equals(other.status)) + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java index 2b0bf6824c..33e36e431e 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java @@ -278,21 +278,12 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; ShardStatistics other = (ShardStatistics) o; - if (this.failed() != other.failed()) { - return false; - } - if (!this.failures().equals(other.failures())) { - return false; - } - if (this.skipped() != other.skipped()) { - return false; - } - if (this.successful() != other.successful()) { - return false; - } - if (this.total() != other.total()) { - return false; - } - return true; + return this.failed() == other.failed() + && (this.failures != null && this.failures.equals(other.failures)) + && this.skipped() == other.skipped() + && this.successful() == other.successful() + && this.total() == other.total() + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/TaskFailure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/TaskFailure.java index fdf2ed92cc..b2608e4f40 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/TaskFailure.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/TaskFailure.java @@ -220,18 +220,11 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; TaskFailure other = (TaskFailure) o; - if (!this.nodeId().equals(other.nodeId())) { - return false; - } - if (!this.reason().equals(other.reason())) { - return false; - } - if (!this.status().equals(other.status())) { - return false; - } - if (this.taskId() != other.taskId()) { - return false; - } - return true; + return (this.nodeId != null && this.nodeId.equals(other.nodeId)) + && (this.reason != null && this.reason.equals(other.reason)) + && (this.status != null && this.status.equals(other.status)) + && this.taskId() == other.taskId() + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java index af01e277e5..80f536cc57 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java @@ -295,30 +295,15 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; WriteResponseBase other = (WriteResponseBase) o; - if (this.forcedRefresh() != other.forcedRefresh()) { - return false; - } - if (!this.id().equals(other.id())) { - return false; - } - if (!this.index().equals(other.index())) { - return false; - } - if (this.primaryTerm() != other.primaryTerm()) { - return false; - } - if (!this.result().equals(other.result())) { - return false; - } - if (this.seqNo() != other.seqNo()) { - return false; - } - if (!this.shards().equals(other.shards())) { - return false; - } - if (this.version() != other.version()) { - return false; - } - return true; + return this.forcedRefresh() == other.forcedRefresh() + && (this.id != null && this.id.equals(other.id)) + && (this.index != null && this.index.equals(other.index)) + && this.primaryTerm() == other.primaryTerm() + && (this.result != null && this.result.equals(other.result)) + && this.seqNo() == other.seqNo() + && (this.shards != null && this.shards.equals(other.shards)) + && this.version() == other.version() + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java index d2197fcee8..1f81ba012f 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java @@ -245,21 +245,12 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; InfoResponse other = (InfoResponse) o; - if (!this.clusterName().equals(other.clusterName())) { - return false; - } - if (!this.clusterUuid().equals(other.clusterUuid())) { - return false; - } - if (!this.name().equals(other.name())) { - return false; - } - if (!this.tagline().equals(other.tagline())) { - return false; - } - if (!this.version().equals(other.version())) { - return false; - } - return true; + return (this.clusterName != null && this.clusterName.equals(other.clusterName)) + && (this.clusterUuid != null && this.clusterUuid.equals(other.clusterUuid)) + && (this.name != null && this.name.equals(other.name)) + && (this.tagline != null && this.tagline.equals(other.tagline)) + && (this.version != null && this.version.equals(other.version)) + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java index 02913e59ec..d726d3e32a 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java @@ -243,15 +243,10 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; ListDanglingIndicesResponse other = (ListDanglingIndicesResponse) o; - if (!this.clusterName().equals(other.clusterName())) { - return false; - } - if (!this.danglingIndices().equals(other.danglingIndices())) { - return false; - } - if (!this.nodes().equals(other.nodes())) { - return false; - } - return true; + return (this.clusterName != null && this.clusterName.equals(other.clusterName)) + && (this.danglingIndices != null && this.danglingIndices.equals(other.danglingIndices)) + && (this.nodes != null && this.nodes.equals(other.nodes)) + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java index e5d979089b..0fe96c0dfb 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java @@ -264,21 +264,12 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; DanglingIndex other = (DanglingIndex) o; - if (!this.creationDate().equals(other.creationDate())) { - return false; - } - if (this.creationDateMillis() != other.creationDateMillis()) { - return false; - } - if (!this.indexName().equals(other.indexName())) { - return false; - } - if (!this.indexUuid().equals(other.indexUuid())) { - return false; - } - if (!this.nodeIds().equals(other.nodeIds())) { - return false; - } - return true; + return (this.creationDate != null && this.creationDate.equals(other.creationDate)) + && this.creationDateMillis() == other.creationDateMillis() + && (this.indexName != null && this.indexName.equals(other.indexName)) + && (this.indexUuid != null && this.indexUuid.equals(other.indexUuid)) + && (this.nodeIds != null && this.nodeIds.equals(other.nodeIds)) + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java index fd8e490187..c85456b222 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java @@ -171,15 +171,10 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; DeployModelResponse other = (DeployModelResponse) o; - if (!this.status().equals(other.status())) { - return false; - } - if (!this.taskId().equals(other.taskId())) { - return false; - } - if (!this.taskType().equals(other.taskType())) { - return false; - } - return true; + return (this.status != null && this.status.equals(other.status)) + && (this.taskId != null && this.taskId.equals(other.taskId)) + && (this.taskType != null && this.taskType.equals(other.taskType)) + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java index 25334bcb51..a6f5792963 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java @@ -272,24 +272,13 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; GetModelGroupResponse other = (GetModelGroupResponse) o; - if (!this.access().equals(other.access())) { - return false; - } - if (this.createdTime() != other.createdTime()) { - return false; - } - if (!this.description().equals(other.description())) { - return false; - } - if (this.lastUpdatedTime() != other.lastUpdatedTime()) { - return false; - } - if (this.latestVersion() != other.latestVersion()) { - return false; - } - if (!this.name().equals(other.name())) { - return false; - } - return true; + return (this.access != null && this.access.equals(other.access)) + && this.createdTime() == other.createdTime() + && (this.description != null && this.description.equals(other.description)) + && this.lastUpdatedTime() == other.lastUpdatedTime() + && this.latestVersion() == other.latestVersion() + && (this.name != null && this.name.equals(other.name)) + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java index 3ee8d07576..6a8564889f 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java @@ -412,36 +412,17 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; GetTaskResponse other = (GetTaskResponse) o; - if (this.createTime() != other.createTime()) { - return false; - } - if (!this.error().equals(other.error())) { - return false; - } - if (!this.functionName().equals(other.functionName())) { - return false; - } - if (this.isAsync() != other.isAsync()) { - return false; - } - if (this.lastUpdateTime() != other.lastUpdateTime()) { - return false; - } - if (!this.modelId().equals(other.modelId())) { - return false; - } - if (!this.state().equals(other.state())) { - return false; - } - if (!this.taskId().equals(other.taskId())) { - return false; - } - if (!this.taskType().equals(other.taskType())) { - return false; - } - if (!this.workerNode().equals(other.workerNode())) { - return false; - } - return true; + return this.createTime() == other.createTime() + && (this.error != null && this.error.equals(other.error)) + && (this.functionName != null && this.functionName.equals(other.functionName)) + && this.isAsync() == other.isAsync() + && this.lastUpdateTime() == other.lastUpdateTime() + && (this.modelId != null && this.modelId.equals(other.modelId)) + && (this.state != null && this.state.equals(other.state)) + && (this.taskId != null && this.taskId.equals(other.taskId)) + && (this.taskType != null && this.taskType.equals(other.taskType)) + && (this.workerNode != null && this.workerNode.equals(other.workerNode)) + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java index f7d9ad6174..3c9e8842f2 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java @@ -155,12 +155,9 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; RegisterModelGroupResponse other = (RegisterModelGroupResponse) o; - if (!this.modelGroupId().equals(other.modelGroupId())) { - return false; - } - if (!this.status().equals(other.status())) { - return false; - } - return true; + return (this.modelGroupId != null && this.modelGroupId.equals(other.modelGroupId)) + && (this.status != null && this.status.equals(other.status)) + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java index b089548fac..73f23ad49a 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java @@ -141,12 +141,8 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; RegisterModelResponse other = (RegisterModelResponse) o; - if (!this.status().equals(other.status())) { - return false; - } - if (!this.taskId().equals(other.taskId())) { - return false; - } - return true; + return (this.status != null && this.status.equals(other.status)) && (this.taskId != null && this.taskId.equals(other.taskId)) + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java index d653c4852b..cd8bbc087c 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java @@ -144,9 +144,8 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; UndeployModelNode other = (UndeployModelNode) o; - if (!this.stats().equals(other.stats())) { - return false; - } - return true; + return (this.stats != null && this.stats.equals(other.stats)) + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java index d2c7bea8eb..21a622b26b 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java @@ -151,9 +151,8 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; UndeployModelResponse other = (UndeployModelResponse) o; - if (!this.nodes().equals(other.nodes())) { - return false; - } - return true; + return (this.nodes != null && this.nodes.equals(other.nodes)) + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java index 37949fc8e2..2d01fe19e1 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java @@ -246,18 +246,11 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; GetTasksResponse other = (GetTasksResponse) o; - if (this.completed() != other.completed()) { - return false; - } - if (!this.error().equals(other.error())) { - return false; - } - if (!this.response().equals(other.response())) { - return false; - } - if (!this.task().equals(other.task())) { - return false; - } - return true; + return this.completed() == other.completed() + && (this.error != null && this.error.equals(other.error)) + && (this.response != null && this.response.equals(other.response)) + && (this.task != null && this.task.equals(other.task)) + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java index e62888e2e2..dba471dff4 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java @@ -796,63 +796,26 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; Status other = (Status) o; - if (this.batches() != other.batches()) { - return false; - } - if (!this.canceled().equals(other.canceled())) { - return false; - } - if (this.created() != other.created()) { - return false; - } - if (this.deleted() != other.deleted()) { - return false; - } - if (this.noops() != other.noops()) { - return false; - } - if (!this.phase().equals(other.phase())) { - return false; - } - if (this.requestsPerSecond() != other.requestsPerSecond()) { - return false; - } - if (!this.retries().equals(other.retries())) { - return false; - } - if (this.sliceId() != other.sliceId()) { - return false; - } - if (!this.slices().equals(other.slices())) { - return false; - } - if (!this.state().equals(other.state())) { - return false; - } - if (!this.throttled().equals(other.throttled())) { - return false; - } - if (this.throttledMillis() != other.throttledMillis()) { - return false; - } - if (!this.throttledUntil().equals(other.throttledUntil())) { - return false; - } - if (this.throttledUntilMillis() != other.throttledUntilMillis()) { - return false; - } - if (this.total() != other.total()) { - return false; - } - if (this.updated() != other.updated()) { - return false; - } - if (this.versionConflicts() != other.versionConflicts()) { - return false; - } - if (!this.metadata().equals(other.metadata())) { - return false; - } - return true; + return this.batches() == other.batches() + && (this.canceled != null && this.canceled.equals(other.canceled)) + && this.created() == other.created() + && this.deleted() == other.deleted() + && this.noops() == other.noops() + && (this.phase != null && this.phase.equals(other.phase)) + && this.requestsPerSecond() == other.requestsPerSecond() + && (this.retries != null && this.retries.equals(other.retries)) + && this.sliceId() == other.sliceId() + && (this.slices != null && this.slices.equals(other.slices)) + && (this.state != null && this.state.equals(other.state)) + && (this.throttled != null && this.throttled.equals(other.throttled)) + && this.throttledMillis() == other.throttledMillis() + && (this.throttledUntil != null && this.throttledUntil.equals(other.throttledUntil)) + && this.throttledUntilMillis() == other.throttledUntilMillis() + && this.total() == other.total() + && this.updated() == other.updated() + && this.versionConflicts() == other.versionConflicts() + && (this.metadata != null && this.metadata.equals(other.metadata)) + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java index 5b801bc859..73c7a40305 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java @@ -174,9 +174,8 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; TaskExecutingNode other = (TaskExecutingNode) o; - if (!this.tasks().equals(other.tasks())) { - return false; - } - return true; + return (this.tasks != null && this.tasks.equals(other.tasks)) + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskGroup.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskGroup.java index 32f8d94b20..9f9945bda7 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskGroup.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskGroup.java @@ -176,9 +176,8 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; TaskGroup other = (TaskGroup) o; - if (!this.children().equals(other.children())) { - return false; - } - return true; + return (this.children != null && this.children.equals(other.children)) + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfo.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfo.java index e5ffef3f56..ceb1688c98 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfo.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfo.java @@ -501,45 +501,20 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; TaskInfo other = (TaskInfo) o; - if (!this.action().equals(other.action())) { - return false; - } - if (this.cancellable() != other.cancellable()) { - return false; - } - if (this.cancelled() != other.cancelled()) { - return false; - } - if (!this.description().equals(other.description())) { - return false; - } - if (!this.headers().equals(other.headers())) { - return false; - } - if (this.id() != other.id()) { - return false; - } - if (!this.node().equals(other.node())) { - return false; - } - if (!this.parentTaskId().equals(other.parentTaskId())) { - return false; - } - if (!this.runningTime().equals(other.runningTime())) { - return false; - } - if (this.runningTimeInNanos() != other.runningTimeInNanos()) { - return false; - } - if (this.startTimeInMillis() != other.startTimeInMillis()) { - return false; - } - if (!this.status().equals(other.status())) { - return false; - } - if (!this.type().equals(other.type())) { - return false; - } - return true; + return (this.action != null && this.action.equals(other.action)) + && this.cancellable() == other.cancellable() + && this.cancelled() == other.cancelled() + && (this.description != null && this.description.equals(other.description)) + && (this.headers != null && this.headers.equals(other.headers)) + && this.id() == other.id() + && (this.node != null && this.node.equals(other.node)) + && (this.parentTaskId != null && this.parentTaskId.equals(other.parentTaskId)) + && (this.runningTime != null && this.runningTime.equals(other.runningTime)) + && this.runningTimeInNanos() == other.runningTimeInNanos() + && this.startTimeInMillis() == other.startTimeInMillis() + && (this.status != null && this.status.equals(other.status)) + && (this.type != null && this.type.equals(other.type)) + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java index 004b0612ab..fa52127870 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java @@ -320,18 +320,11 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; TaskListResponseBase other = (TaskListResponseBase) o; - if (!this.nodeFailures().equals(other.nodeFailures())) { - return false; - } - if (!this.nodes().equals(other.nodes())) { - return false; - } - if (!this.taskFailures().equals(other.taskFailures())) { - return false; - } - if (!this.tasks().equals(other.tasks())) { - return false; - } - return true; + return (this.nodeFailures != null && this.nodeFailures.equals(other.nodeFailures)) + && (this.nodes != null && this.nodes.equals(other.nodes)) + && (this.taskFailures != null && this.taskFailures.equals(other.taskFailures)) + && (this.tasks != null && this.tasks.equals(other.tasks)) + + ; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java index 6677e33529..068264c3dc 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java @@ -747,63 +747,26 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; TaskResponse other = (TaskResponse) o; - if (this.batches() != other.batches()) { - return false; - } - if (!this.canceled().equals(other.canceled())) { - return false; - } - if (this.created() != other.created()) { - return false; - } - if (this.deleted() != other.deleted()) { - return false; - } - if (!this.failures().equals(other.failures())) { - return false; - } - if (this.noops() != other.noops()) { - return false; - } - if (this.requestsPerSecond() != other.requestsPerSecond()) { - return false; - } - if (!this.retries().equals(other.retries())) { - return false; - } - if (this.sliceId() != other.sliceId()) { - return false; - } - if (!this.slices().equals(other.slices())) { - return false; - } - if (!this.throttled().equals(other.throttled())) { - return false; - } - if (this.throttledMillis() != other.throttledMillis()) { - return false; - } - if (!this.throttledUntil().equals(other.throttledUntil())) { - return false; - } - if (this.throttledUntilMillis() != other.throttledUntilMillis()) { - return false; - } - if (this.timedOut() != other.timedOut()) { - return false; - } - if (this.took() != other.took()) { - return false; - } - if (this.total() != other.total()) { - return false; - } - if (this.updated() != other.updated()) { - return false; - } - if (this.versionConflicts() != other.versionConflicts()) { - return false; - } - return true; + return this.batches() == other.batches() + && (this.canceled != null && this.canceled.equals(other.canceled)) + && this.created() == other.created() + && this.deleted() == other.deleted() + && (this.failures != null && this.failures.equals(other.failures)) + && this.noops() == other.noops() + && this.requestsPerSecond() == other.requestsPerSecond() + && (this.retries != null && this.retries.equals(other.retries)) + && this.sliceId() == other.sliceId() + && (this.slices != null && this.slices.equals(other.slices)) + && (this.throttled != null && this.throttled.equals(other.throttled)) + && this.throttledMillis() == other.throttledMillis() + && (this.throttledUntil != null && this.throttledUntil.equals(other.throttledUntil)) + && this.throttledUntilMillis() == other.throttledUntilMillis() + && this.timedOut() == other.timedOut() + && this.took() == other.took() + && this.total() == other.total() + && this.updated() == other.updated() + && this.versionConflicts() == other.versionConflicts() + + ; } } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache index 70ea7234d8..068331fb7f 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache @@ -7,15 +7,13 @@ if(this == o) return true; if(this.getClass() != o.getClass()) return false; {{className}} other = ({{className}})o; + return {{^hasFieldsToSerialize}}true{{/hasFieldsToSerialize}} {{#fields}} {{#isUnboxedPrimitive}} - if(this.{{name}}() != other.{{name}}()) { + this.{{name}}() == other.{{name}}() {{/isUnboxedPrimitive}} {{^isUnboxedPrimitive}} - if(!Objects.equals(this.{{name}}, other.{{name}})) { - {{/isUnboxedPrimitive}} - return false; - } - {{/fields}} - return true; + (this.{{name}} != null && this.{{name}}.equals(other.{{name}})) + {{/isUnboxedPrimitive}}{{^-last}} && {{/-last}} + {{/fields}}; } From ab5d0e979a907a6df4ca287163c8c7fd3d6b3f7c Mon Sep 17 00:00:00 2001 From: miguel-vila Date: Fri, 20 Sep 2024 10:46:20 +0100 Subject: [PATCH 08/16] adjust last line Signed-off-by: miguel-vila --- .../client/opensearch/_types/AcknowledgedResponseBase.java | 4 +--- .../org/opensearch/client/opensearch/_types/BaseNode.java | 4 +--- .../client/opensearch/_types/BulkByScrollFailure.java | 4 +--- .../client/opensearch/_types/BulkByScrollTaskStatus.java | 4 +--- .../org/opensearch/client/opensearch/_types/ErrorCause.java | 4 +--- .../opensearch/client/opensearch/_types/NodeStatistics.java | 4 +--- .../client/opensearch/_types/OpenSearchVersionInfo.java | 4 +--- .../org/opensearch/client/opensearch/_types/Retries.java | 4 +--- .../opensearch/client/opensearch/_types/ShardFailure.java | 4 +--- .../opensearch/client/opensearch/_types/ShardStatistics.java | 4 +--- .../org/opensearch/client/opensearch/_types/TaskFailure.java | 4 +--- .../client/opensearch/_types/WriteResponseBase.java | 4 +--- .../org/opensearch/client/opensearch/core/InfoResponse.java | 4 +--- .../dangling_indices/ListDanglingIndicesResponse.java | 4 +--- .../list_dangling_indices/DanglingIndex.java | 4 +--- .../opensearch/client/opensearch/ml/DeployModelResponse.java | 4 +--- .../client/opensearch/ml/GetModelGroupResponse.java | 4 +--- .../org/opensearch/client/opensearch/ml/GetTaskResponse.java | 4 +--- .../client/opensearch/ml/RegisterModelGroupResponse.java | 4 +--- .../client/opensearch/ml/RegisterModelResponse.java | 4 +--- .../opensearch/client/opensearch/ml/UndeployModelNode.java | 4 +--- .../client/opensearch/ml/UndeployModelResponse.java | 4 +--- .../opensearch/client/opensearch/tasks/GetTasksResponse.java | 4 +--- .../java/org/opensearch/client/opensearch/tasks/Status.java | 4 +--- .../client/opensearch/tasks/TaskExecutingNode.java | 4 +--- .../org/opensearch/client/opensearch/tasks/TaskGroup.java | 4 +--- .../org/opensearch/client/opensearch/tasks/TaskInfo.java | 4 +--- .../client/opensearch/tasks/TaskListResponseBase.java | 4 +--- .../org/opensearch/client/opensearch/tasks/TaskResponse.java | 4 +--- .../client/codegen/templates/ObjectShape/Equals.mustache | 5 ++++- 30 files changed, 33 insertions(+), 88 deletions(-) diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java index 617cc546d2..631c4bdef1 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java @@ -120,8 +120,6 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; AcknowledgedResponseBase other = (AcknowledgedResponseBase) o; - return this.acknowledged() == other.acknowledged() - - ; + return this.acknowledged() == other.acknowledged(); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java index c0e222b6ec..64353cab0a 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java @@ -302,8 +302,6 @@ public boolean equals(Object o) { && (this.ip != null && this.ip.equals(other.ip)) && (this.name != null && this.name.equals(other.name)) && (this.roles != null && this.roles.equals(other.roles)) - && (this.transportAddress != null && this.transportAddress.equals(other.transportAddress)) - - ; + && (this.transportAddress != null && this.transportAddress.equals(other.transportAddress)); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java index a5593e00be..4f2243eb1c 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java @@ -336,8 +336,6 @@ public boolean equals(Object o) { && (this.node != null && this.node.equals(other.node)) && (this.reason != null && this.reason.equals(other.reason)) && this.shard() == other.shard() - && this.status() == other.status() - - ; + && this.status() == other.status(); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatus.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatus.java index dac7ec447e..024d35524d 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatus.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatus.java @@ -655,8 +655,6 @@ public boolean equals(Object o) { && this.throttledUntilMillis() == other.throttledUntilMillis() && this.total() == other.total() && this.updated() == other.updated() - && this.versionConflicts() == other.versionConflicts() - - ; + && this.versionConflicts() == other.versionConflicts(); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java index 05753a914d..b6281176f5 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java @@ -427,8 +427,6 @@ public boolean equals(Object o) { && (this.stackTrace != null && this.stackTrace.equals(other.stackTrace)) && (this.suppressed != null && this.suppressed.equals(other.suppressed)) && (this.type != null && this.type.equals(other.type)) - && (this.metadata != null && this.metadata.equals(other.metadata)) - - ; + && (this.metadata != null && this.metadata.equals(other.metadata)); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java index 4870dea3b9..258990c17a 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java @@ -272,8 +272,6 @@ public boolean equals(Object o) { return this.failed() == other.failed() && (this.failures != null && this.failures.equals(other.failures)) && this.successful() == other.successful() - && this.total() == other.total() - - ; + && this.total() == other.total(); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java index 329fec29ed..3f20a31271 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java @@ -382,8 +382,6 @@ public boolean equals(Object o) { && this.minimumIndexCompatibilityVersion.equals(other.minimumIndexCompatibilityVersion)) && (this.minimumWireCompatibilityVersion != null && this.minimumWireCompatibilityVersion.equals(other.minimumWireCompatibilityVersion)) - && (this.number != null && this.number.equals(other.number)) - - ; + && (this.number != null && this.number.equals(other.number)); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Retries.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Retries.java index 5d77839f32..84cc154599 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Retries.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Retries.java @@ -165,8 +165,6 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; Retries other = (Retries) o; - return this.bulk() == other.bulk() && this.search() == other.search() - - ; + return this.bulk() == other.bulk() && this.search() == other.search(); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java index 26dd7bdd7e..49d6dc5de5 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java @@ -264,8 +264,6 @@ public boolean equals(Object o) { && (this.node != null && this.node.equals(other.node)) && (this.reason != null && this.reason.equals(other.reason)) && this.shard() == other.shard() - && (this.status != null && this.status.equals(other.status)) - - ; + && (this.status != null && this.status.equals(other.status)); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java index 33e36e431e..e3d9b1f7d5 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java @@ -282,8 +282,6 @@ public boolean equals(Object o) { && (this.failures != null && this.failures.equals(other.failures)) && this.skipped() == other.skipped() && this.successful() == other.successful() - && this.total() == other.total() - - ; + && this.total() == other.total(); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/TaskFailure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/TaskFailure.java index b2608e4f40..735758a9d8 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/TaskFailure.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/TaskFailure.java @@ -223,8 +223,6 @@ public boolean equals(Object o) { return (this.nodeId != null && this.nodeId.equals(other.nodeId)) && (this.reason != null && this.reason.equals(other.reason)) && (this.status != null && this.status.equals(other.status)) - && this.taskId() == other.taskId() - - ; + && this.taskId() == other.taskId(); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java index 80f536cc57..f06964d55e 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java @@ -302,8 +302,6 @@ public boolean equals(Object o) { && (this.result != null && this.result.equals(other.result)) && this.seqNo() == other.seqNo() && (this.shards != null && this.shards.equals(other.shards)) - && this.version() == other.version() - - ; + && this.version() == other.version(); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java index 1f81ba012f..28740e05e5 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java @@ -249,8 +249,6 @@ public boolean equals(Object o) { && (this.clusterUuid != null && this.clusterUuid.equals(other.clusterUuid)) && (this.name != null && this.name.equals(other.name)) && (this.tagline != null && this.tagline.equals(other.tagline)) - && (this.version != null && this.version.equals(other.version)) - - ; + && (this.version != null && this.version.equals(other.version)); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java index d726d3e32a..b2770e9c68 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java @@ -245,8 +245,6 @@ public boolean equals(Object o) { ListDanglingIndicesResponse other = (ListDanglingIndicesResponse) o; return (this.clusterName != null && this.clusterName.equals(other.clusterName)) && (this.danglingIndices != null && this.danglingIndices.equals(other.danglingIndices)) - && (this.nodes != null && this.nodes.equals(other.nodes)) - - ; + && (this.nodes != null && this.nodes.equals(other.nodes)); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java index 0fe96c0dfb..af677346d6 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java @@ -268,8 +268,6 @@ public boolean equals(Object o) { && this.creationDateMillis() == other.creationDateMillis() && (this.indexName != null && this.indexName.equals(other.indexName)) && (this.indexUuid != null && this.indexUuid.equals(other.indexUuid)) - && (this.nodeIds != null && this.nodeIds.equals(other.nodeIds)) - - ; + && (this.nodeIds != null && this.nodeIds.equals(other.nodeIds)); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java index c85456b222..96b2b22bcb 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java @@ -173,8 +173,6 @@ public boolean equals(Object o) { DeployModelResponse other = (DeployModelResponse) o; return (this.status != null && this.status.equals(other.status)) && (this.taskId != null && this.taskId.equals(other.taskId)) - && (this.taskType != null && this.taskType.equals(other.taskType)) - - ; + && (this.taskType != null && this.taskType.equals(other.taskType)); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java index a6f5792963..a415731120 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java @@ -277,8 +277,6 @@ public boolean equals(Object o) { && (this.description != null && this.description.equals(other.description)) && this.lastUpdatedTime() == other.lastUpdatedTime() && this.latestVersion() == other.latestVersion() - && (this.name != null && this.name.equals(other.name)) - - ; + && (this.name != null && this.name.equals(other.name)); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java index 6a8564889f..890a36ead8 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java @@ -421,8 +421,6 @@ public boolean equals(Object o) { && (this.state != null && this.state.equals(other.state)) && (this.taskId != null && this.taskId.equals(other.taskId)) && (this.taskType != null && this.taskType.equals(other.taskType)) - && (this.workerNode != null && this.workerNode.equals(other.workerNode)) - - ; + && (this.workerNode != null && this.workerNode.equals(other.workerNode)); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java index 3c9e8842f2..b3454837af 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java @@ -156,8 +156,6 @@ public boolean equals(Object o) { if (this.getClass() != o.getClass()) return false; RegisterModelGroupResponse other = (RegisterModelGroupResponse) o; return (this.modelGroupId != null && this.modelGroupId.equals(other.modelGroupId)) - && (this.status != null && this.status.equals(other.status)) - - ; + && (this.status != null && this.status.equals(other.status)); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java index 73f23ad49a..862df5e7ec 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java @@ -141,8 +141,6 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; RegisterModelResponse other = (RegisterModelResponse) o; - return (this.status != null && this.status.equals(other.status)) && (this.taskId != null && this.taskId.equals(other.taskId)) - - ; + return (this.status != null && this.status.equals(other.status)) && (this.taskId != null && this.taskId.equals(other.taskId)); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java index cd8bbc087c..1b0b031784 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java @@ -144,8 +144,6 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; UndeployModelNode other = (UndeployModelNode) o; - return (this.stats != null && this.stats.equals(other.stats)) - - ; + return (this.stats != null && this.stats.equals(other.stats)); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java index 21a622b26b..9f92316154 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java @@ -151,8 +151,6 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; UndeployModelResponse other = (UndeployModelResponse) o; - return (this.nodes != null && this.nodes.equals(other.nodes)) - - ; + return (this.nodes != null && this.nodes.equals(other.nodes)); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java index 2d01fe19e1..81a4631b3f 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java @@ -249,8 +249,6 @@ public boolean equals(Object o) { return this.completed() == other.completed() && (this.error != null && this.error.equals(other.error)) && (this.response != null && this.response.equals(other.response)) - && (this.task != null && this.task.equals(other.task)) - - ; + && (this.task != null && this.task.equals(other.task)); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java index dba471dff4..206f6f7097 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java @@ -814,8 +814,6 @@ public boolean equals(Object o) { && this.total() == other.total() && this.updated() == other.updated() && this.versionConflicts() == other.versionConflicts() - && (this.metadata != null && this.metadata.equals(other.metadata)) - - ; + && (this.metadata != null && this.metadata.equals(other.metadata)); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java index 73c7a40305..2c6bde6621 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java @@ -174,8 +174,6 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; TaskExecutingNode other = (TaskExecutingNode) o; - return (this.tasks != null && this.tasks.equals(other.tasks)) - - ; + return (this.tasks != null && this.tasks.equals(other.tasks)); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskGroup.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskGroup.java index 9f9945bda7..9d32d2d67c 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskGroup.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskGroup.java @@ -176,8 +176,6 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; TaskGroup other = (TaskGroup) o; - return (this.children != null && this.children.equals(other.children)) - - ; + return (this.children != null && this.children.equals(other.children)); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfo.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfo.java index ceb1688c98..5580efd3a1 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfo.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfo.java @@ -513,8 +513,6 @@ public boolean equals(Object o) { && this.runningTimeInNanos() == other.runningTimeInNanos() && this.startTimeInMillis() == other.startTimeInMillis() && (this.status != null && this.status.equals(other.status)) - && (this.type != null && this.type.equals(other.type)) - - ; + && (this.type != null && this.type.equals(other.type)); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java index fa52127870..2aa7b6d7ba 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java @@ -323,8 +323,6 @@ public boolean equals(Object o) { return (this.nodeFailures != null && this.nodeFailures.equals(other.nodeFailures)) && (this.nodes != null && this.nodes.equals(other.nodes)) && (this.taskFailures != null && this.taskFailures.equals(other.taskFailures)) - && (this.tasks != null && this.tasks.equals(other.tasks)) - - ; + && (this.tasks != null && this.tasks.equals(other.tasks)); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java index 068264c3dc..3ff543f127 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java @@ -765,8 +765,6 @@ public boolean equals(Object o) { && this.took() == other.took() && this.total() == other.total() && this.updated() == other.updated() - && this.versionConflicts() == other.versionConflicts() - - ; + && this.versionConflicts() == other.versionConflicts(); } } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache index 068331fb7f..f3fa0a2f37 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache @@ -14,6 +14,9 @@ {{/isUnboxedPrimitive}} {{^isUnboxedPrimitive}} (this.{{name}} != null && this.{{name}}.equals(other.{{name}})) - {{/isUnboxedPrimitive}}{{^-last}} && {{/-last}} + {{/isUnboxedPrimitive}} + {{^-last}} + && + {{/-last}} {{/fields}}; } From 492de4e784b6d7804dd3fbcfa3cf157d708a0df1 Mon Sep 17 00:00:00 2001 From: miguel-vila Date: Fri, 20 Sep 2024 11:18:24 +0100 Subject: [PATCH 09/16] use fqn Signed-off-by: miguel-vila --- .../client/opensearch/_types/BaseNode.java | 12 +++++------ .../_types/BulkByScrollFailure.java | 10 +++++----- .../_types/BulkByScrollTaskStatus.java | 10 +++++----- .../client/opensearch/_types/ErrorCause.java | 14 ++++++------- .../opensearch/_types/NodeStatistics.java | 2 +- .../_types/OpenSearchVersionInfo.java | 20 +++++++++---------- .../opensearch/_types/ShardFailure.java | 8 ++++---- .../opensearch/_types/ShardStatistics.java | 2 +- .../client/opensearch/_types/TaskFailure.java | 6 +++--- .../opensearch/_types/WriteResponseBase.java | 8 ++++---- .../client/opensearch/core/InfoResponse.java | 10 +++++----- .../ListDanglingIndicesResponse.java | 6 +++--- .../list_dangling_indices/DanglingIndex.java | 8 ++++---- .../opensearch/ml/DeployModelResponse.java | 6 +++--- .../opensearch/ml/GetModelGroupResponse.java | 6 +++--- .../client/opensearch/ml/GetTaskResponse.java | 14 ++++++------- .../ml/RegisterModelGroupResponse.java | 3 +-- .../opensearch/ml/RegisterModelResponse.java | 2 +- .../opensearch/ml/UndeployModelNode.java | 2 +- .../opensearch/ml/UndeployModelResponse.java | 2 +- .../opensearch/tasks/GetTasksResponse.java | 6 +++--- .../client/opensearch/tasks/Status.java | 16 +++++++-------- .../opensearch/tasks/TaskExecutingNode.java | 2 +- .../client/opensearch/tasks/TaskGroup.java | 2 +- .../client/opensearch/tasks/TaskInfo.java | 16 +++++++-------- .../tasks/TaskListResponseBase.java | 8 ++++---- .../client/opensearch/tasks/TaskResponse.java | 12 +++++------ .../client/codegen/model/Types.java | 1 + .../templates/ObjectShape/Equals.mustache | 2 +- 29 files changed, 107 insertions(+), 109 deletions(-) diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java index 64353cab0a..7346291502 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java @@ -297,11 +297,11 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; BaseNode other = (BaseNode) o; - return (this.attributes != null && this.attributes.equals(other.attributes)) - && (this.host != null && this.host.equals(other.host)) - && (this.ip != null && this.ip.equals(other.ip)) - && (this.name != null && this.name.equals(other.name)) - && (this.roles != null && this.roles.equals(other.roles)) - && (this.transportAddress != null && this.transportAddress.equals(other.transportAddress)); + return java.util.Objects.equals(this.attributes, other.attributes) + && java.util.Objects.equals(this.host, other.host) + && java.util.Objects.equals(this.ip, other.ip) + && java.util.Objects.equals(this.name, other.name) + && java.util.Objects.equals(this.roles, other.roles) + && java.util.Objects.equals(this.transportAddress, other.transportAddress); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java index 4f2243eb1c..9001de4dd4 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java @@ -330,11 +330,11 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; BulkByScrollFailure other = (BulkByScrollFailure) o; - return (this.cause != null && this.cause.equals(other.cause)) - && (this.id != null && this.id.equals(other.id)) - && (this.index != null && this.index.equals(other.index)) - && (this.node != null && this.node.equals(other.node)) - && (this.reason != null && this.reason.equals(other.reason)) + return java.util.Objects.equals(this.cause, other.cause) + && java.util.Objects.equals(this.id, other.id) + && java.util.Objects.equals(this.index, other.index) + && java.util.Objects.equals(this.node, other.node) + && java.util.Objects.equals(this.reason, other.reason) && this.shard() == other.shard() && this.status() == other.status(); } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatus.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatus.java index 024d35524d..a44549b7eb 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatus.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatus.java @@ -641,17 +641,17 @@ public boolean equals(Object o) { if (this.getClass() != o.getClass()) return false; BulkByScrollTaskStatus other = (BulkByScrollTaskStatus) o; return this.batches() == other.batches() - && (this.canceled != null && this.canceled.equals(other.canceled)) + && java.util.Objects.equals(this.canceled, other.canceled) && this.created() == other.created() && this.deleted() == other.deleted() && this.noops() == other.noops() && this.requestsPerSecond() == other.requestsPerSecond() - && (this.retries != null && this.retries.equals(other.retries)) + && java.util.Objects.equals(this.retries, other.retries) && this.sliceId() == other.sliceId() - && (this.slices != null && this.slices.equals(other.slices)) - && (this.throttled != null && this.throttled.equals(other.throttled)) + && java.util.Objects.equals(this.slices, other.slices) + && java.util.Objects.equals(this.throttled, other.throttled) && this.throttledMillis() == other.throttledMillis() - && (this.throttledUntil != null && this.throttledUntil.equals(other.throttledUntil)) + && java.util.Objects.equals(this.throttledUntil, other.throttledUntil) && this.throttledUntilMillis() == other.throttledUntilMillis() && this.total() == other.total() && this.updated() == other.updated() diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java index b6281176f5..3d3f834ad0 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java @@ -421,12 +421,12 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; ErrorCause other = (ErrorCause) o; - return (this.causedBy != null && this.causedBy.equals(other.causedBy)) - && (this.reason != null && this.reason.equals(other.reason)) - && (this.rootCause != null && this.rootCause.equals(other.rootCause)) - && (this.stackTrace != null && this.stackTrace.equals(other.stackTrace)) - && (this.suppressed != null && this.suppressed.equals(other.suppressed)) - && (this.type != null && this.type.equals(other.type)) - && (this.metadata != null && this.metadata.equals(other.metadata)); + return java.util.Objects.equals(this.causedBy, other.causedBy) + && java.util.Objects.equals(this.reason, other.reason) + && java.util.Objects.equals(this.rootCause, other.rootCause) + && java.util.Objects.equals(this.stackTrace, other.stackTrace) + && java.util.Objects.equals(this.suppressed, other.suppressed) + && java.util.Objects.equals(this.type, other.type) + && java.util.Objects.equals(this.metadata, other.metadata); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java index 258990c17a..a0588cd597 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java @@ -270,7 +270,7 @@ public boolean equals(Object o) { if (this.getClass() != o.getClass()) return false; NodeStatistics other = (NodeStatistics) o; return this.failed() == other.failed() - && (this.failures != null && this.failures.equals(other.failures)) + && java.util.Objects.equals(this.failures, other.failures) && this.successful() == other.successful() && this.total() == other.total(); } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java index 3f20a31271..62c5ab5f50 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java @@ -371,17 +371,15 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; OpenSearchVersionInfo other = (OpenSearchVersionInfo) o; - return (this.buildDate != null && this.buildDate.equals(other.buildDate)) - && (this.buildFlavor != null && this.buildFlavor.equals(other.buildFlavor)) - && (this.buildHash != null && this.buildHash.equals(other.buildHash)) + return java.util.Objects.equals(this.buildDate, other.buildDate) + && java.util.Objects.equals(this.buildFlavor, other.buildFlavor) + && java.util.Objects.equals(this.buildHash, other.buildHash) && this.buildSnapshot() == other.buildSnapshot() - && (this.buildType != null && this.buildType.equals(other.buildType)) - && (this.distribution != null && this.distribution.equals(other.distribution)) - && (this.luceneVersion != null && this.luceneVersion.equals(other.luceneVersion)) - && (this.minimumIndexCompatibilityVersion != null - && this.minimumIndexCompatibilityVersion.equals(other.minimumIndexCompatibilityVersion)) - && (this.minimumWireCompatibilityVersion != null - && this.minimumWireCompatibilityVersion.equals(other.minimumWireCompatibilityVersion)) - && (this.number != null && this.number.equals(other.number)); + && java.util.Objects.equals(this.buildType, other.buildType) + && java.util.Objects.equals(this.distribution, other.distribution) + && java.util.Objects.equals(this.luceneVersion, other.luceneVersion) + && java.util.Objects.equals(this.minimumIndexCompatibilityVersion, other.minimumIndexCompatibilityVersion) + && java.util.Objects.equals(this.minimumWireCompatibilityVersion, other.minimumWireCompatibilityVersion) + && java.util.Objects.equals(this.number, other.number); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java index 49d6dc5de5..19d7915ac5 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java @@ -260,10 +260,10 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; ShardFailure other = (ShardFailure) o; - return (this.index != null && this.index.equals(other.index)) - && (this.node != null && this.node.equals(other.node)) - && (this.reason != null && this.reason.equals(other.reason)) + return java.util.Objects.equals(this.index, other.index) + && java.util.Objects.equals(this.node, other.node) + && java.util.Objects.equals(this.reason, other.reason) && this.shard() == other.shard() - && (this.status != null && this.status.equals(other.status)); + && java.util.Objects.equals(this.status, other.status); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java index e3d9b1f7d5..ccefee390c 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java @@ -279,7 +279,7 @@ public boolean equals(Object o) { if (this.getClass() != o.getClass()) return false; ShardStatistics other = (ShardStatistics) o; return this.failed() == other.failed() - && (this.failures != null && this.failures.equals(other.failures)) + && java.util.Objects.equals(this.failures, other.failures) && this.skipped() == other.skipped() && this.successful() == other.successful() && this.total() == other.total(); diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/TaskFailure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/TaskFailure.java index 735758a9d8..2bb9100588 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/TaskFailure.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/TaskFailure.java @@ -220,9 +220,9 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; TaskFailure other = (TaskFailure) o; - return (this.nodeId != null && this.nodeId.equals(other.nodeId)) - && (this.reason != null && this.reason.equals(other.reason)) - && (this.status != null && this.status.equals(other.status)) + return java.util.Objects.equals(this.nodeId, other.nodeId) + && java.util.Objects.equals(this.reason, other.reason) + && java.util.Objects.equals(this.status, other.status) && this.taskId() == other.taskId(); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java index f06964d55e..084df375cb 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java @@ -296,12 +296,12 @@ public boolean equals(Object o) { if (this.getClass() != o.getClass()) return false; WriteResponseBase other = (WriteResponseBase) o; return this.forcedRefresh() == other.forcedRefresh() - && (this.id != null && this.id.equals(other.id)) - && (this.index != null && this.index.equals(other.index)) + && java.util.Objects.equals(this.id, other.id) + && java.util.Objects.equals(this.index, other.index) && this.primaryTerm() == other.primaryTerm() - && (this.result != null && this.result.equals(other.result)) + && java.util.Objects.equals(this.result, other.result) && this.seqNo() == other.seqNo() - && (this.shards != null && this.shards.equals(other.shards)) + && java.util.Objects.equals(this.shards, other.shards) && this.version() == other.version(); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java index 28740e05e5..cc77e472de 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java @@ -245,10 +245,10 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; InfoResponse other = (InfoResponse) o; - return (this.clusterName != null && this.clusterName.equals(other.clusterName)) - && (this.clusterUuid != null && this.clusterUuid.equals(other.clusterUuid)) - && (this.name != null && this.name.equals(other.name)) - && (this.tagline != null && this.tagline.equals(other.tagline)) - && (this.version != null && this.version.equals(other.version)); + return java.util.Objects.equals(this.clusterName, other.clusterName) + && java.util.Objects.equals(this.clusterUuid, other.clusterUuid) + && java.util.Objects.equals(this.name, other.name) + && java.util.Objects.equals(this.tagline, other.tagline) + && java.util.Objects.equals(this.version, other.version); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java index b2770e9c68..1181fb28c5 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java @@ -243,8 +243,8 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; ListDanglingIndicesResponse other = (ListDanglingIndicesResponse) o; - return (this.clusterName != null && this.clusterName.equals(other.clusterName)) - && (this.danglingIndices != null && this.danglingIndices.equals(other.danglingIndices)) - && (this.nodes != null && this.nodes.equals(other.nodes)); + return java.util.Objects.equals(this.clusterName, other.clusterName) + && java.util.Objects.equals(this.danglingIndices, other.danglingIndices) + && java.util.Objects.equals(this.nodes, other.nodes); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java index af677346d6..bb6e0ea9f6 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java @@ -264,10 +264,10 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; DanglingIndex other = (DanglingIndex) o; - return (this.creationDate != null && this.creationDate.equals(other.creationDate)) + return java.util.Objects.equals(this.creationDate, other.creationDate) && this.creationDateMillis() == other.creationDateMillis() - && (this.indexName != null && this.indexName.equals(other.indexName)) - && (this.indexUuid != null && this.indexUuid.equals(other.indexUuid)) - && (this.nodeIds != null && this.nodeIds.equals(other.nodeIds)); + && java.util.Objects.equals(this.indexName, other.indexName) + && java.util.Objects.equals(this.indexUuid, other.indexUuid) + && java.util.Objects.equals(this.nodeIds, other.nodeIds); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java index 96b2b22bcb..554024bbc0 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java @@ -171,8 +171,8 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; DeployModelResponse other = (DeployModelResponse) o; - return (this.status != null && this.status.equals(other.status)) - && (this.taskId != null && this.taskId.equals(other.taskId)) - && (this.taskType != null && this.taskType.equals(other.taskType)); + return java.util.Objects.equals(this.status, other.status) + && java.util.Objects.equals(this.taskId, other.taskId) + && java.util.Objects.equals(this.taskType, other.taskType); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java index a415731120..19eda05c59 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java @@ -272,11 +272,11 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; GetModelGroupResponse other = (GetModelGroupResponse) o; - return (this.access != null && this.access.equals(other.access)) + return java.util.Objects.equals(this.access, other.access) && this.createdTime() == other.createdTime() - && (this.description != null && this.description.equals(other.description)) + && java.util.Objects.equals(this.description, other.description) && this.lastUpdatedTime() == other.lastUpdatedTime() && this.latestVersion() == other.latestVersion() - && (this.name != null && this.name.equals(other.name)); + && java.util.Objects.equals(this.name, other.name); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java index 890a36ead8..7bf92c6ee6 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java @@ -413,14 +413,14 @@ public boolean equals(Object o) { if (this.getClass() != o.getClass()) return false; GetTaskResponse other = (GetTaskResponse) o; return this.createTime() == other.createTime() - && (this.error != null && this.error.equals(other.error)) - && (this.functionName != null && this.functionName.equals(other.functionName)) + && java.util.Objects.equals(this.error, other.error) + && java.util.Objects.equals(this.functionName, other.functionName) && this.isAsync() == other.isAsync() && this.lastUpdateTime() == other.lastUpdateTime() - && (this.modelId != null && this.modelId.equals(other.modelId)) - && (this.state != null && this.state.equals(other.state)) - && (this.taskId != null && this.taskId.equals(other.taskId)) - && (this.taskType != null && this.taskType.equals(other.taskType)) - && (this.workerNode != null && this.workerNode.equals(other.workerNode)); + && java.util.Objects.equals(this.modelId, other.modelId) + && java.util.Objects.equals(this.state, other.state) + && java.util.Objects.equals(this.taskId, other.taskId) + && java.util.Objects.equals(this.taskType, other.taskType) + && java.util.Objects.equals(this.workerNode, other.workerNode); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java index b3454837af..9465a81c0d 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java @@ -155,7 +155,6 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; RegisterModelGroupResponse other = (RegisterModelGroupResponse) o; - return (this.modelGroupId != null && this.modelGroupId.equals(other.modelGroupId)) - && (this.status != null && this.status.equals(other.status)); + return java.util.Objects.equals(this.modelGroupId, other.modelGroupId) && java.util.Objects.equals(this.status, other.status); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java index 862df5e7ec..63cab5cf20 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java @@ -141,6 +141,6 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; RegisterModelResponse other = (RegisterModelResponse) o; - return (this.status != null && this.status.equals(other.status)) && (this.taskId != null && this.taskId.equals(other.taskId)); + return java.util.Objects.equals(this.status, other.status) && java.util.Objects.equals(this.taskId, other.taskId); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java index 1b0b031784..a4af02d346 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java @@ -144,6 +144,6 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; UndeployModelNode other = (UndeployModelNode) o; - return (this.stats != null && this.stats.equals(other.stats)); + return java.util.Objects.equals(this.stats, other.stats); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java index 9f92316154..20073029cf 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java @@ -151,6 +151,6 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; UndeployModelResponse other = (UndeployModelResponse) o; - return (this.nodes != null && this.nodes.equals(other.nodes)); + return java.util.Objects.equals(this.nodes, other.nodes); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java index 81a4631b3f..472ef67547 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java @@ -247,8 +247,8 @@ public boolean equals(Object o) { if (this.getClass() != o.getClass()) return false; GetTasksResponse other = (GetTasksResponse) o; return this.completed() == other.completed() - && (this.error != null && this.error.equals(other.error)) - && (this.response != null && this.response.equals(other.response)) - && (this.task != null && this.task.equals(other.task)); + && java.util.Objects.equals(this.error, other.error) + && java.util.Objects.equals(this.response, other.response) + && java.util.Objects.equals(this.task, other.task); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java index 206f6f7097..c5fded3e17 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java @@ -797,23 +797,23 @@ public boolean equals(Object o) { if (this.getClass() != o.getClass()) return false; Status other = (Status) o; return this.batches() == other.batches() - && (this.canceled != null && this.canceled.equals(other.canceled)) + && java.util.Objects.equals(this.canceled, other.canceled) && this.created() == other.created() && this.deleted() == other.deleted() && this.noops() == other.noops() - && (this.phase != null && this.phase.equals(other.phase)) + && java.util.Objects.equals(this.phase, other.phase) && this.requestsPerSecond() == other.requestsPerSecond() - && (this.retries != null && this.retries.equals(other.retries)) + && java.util.Objects.equals(this.retries, other.retries) && this.sliceId() == other.sliceId() - && (this.slices != null && this.slices.equals(other.slices)) - && (this.state != null && this.state.equals(other.state)) - && (this.throttled != null && this.throttled.equals(other.throttled)) + && java.util.Objects.equals(this.slices, other.slices) + && java.util.Objects.equals(this.state, other.state) + && java.util.Objects.equals(this.throttled, other.throttled) && this.throttledMillis() == other.throttledMillis() - && (this.throttledUntil != null && this.throttledUntil.equals(other.throttledUntil)) + && java.util.Objects.equals(this.throttledUntil, other.throttledUntil) && this.throttledUntilMillis() == other.throttledUntilMillis() && this.total() == other.total() && this.updated() == other.updated() && this.versionConflicts() == other.versionConflicts() - && (this.metadata != null && this.metadata.equals(other.metadata)); + && java.util.Objects.equals(this.metadata, other.metadata); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java index 2c6bde6621..cf7044462d 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java @@ -174,6 +174,6 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; TaskExecutingNode other = (TaskExecutingNode) o; - return (this.tasks != null && this.tasks.equals(other.tasks)); + return java.util.Objects.equals(this.tasks, other.tasks); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskGroup.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskGroup.java index 9d32d2d67c..04c1875a62 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskGroup.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskGroup.java @@ -176,6 +176,6 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; TaskGroup other = (TaskGroup) o; - return (this.children != null && this.children.equals(other.children)); + return java.util.Objects.equals(this.children, other.children); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfo.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfo.java index 5580efd3a1..9ae6a65e1e 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfo.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfo.java @@ -501,18 +501,18 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; TaskInfo other = (TaskInfo) o; - return (this.action != null && this.action.equals(other.action)) + return java.util.Objects.equals(this.action, other.action) && this.cancellable() == other.cancellable() && this.cancelled() == other.cancelled() - && (this.description != null && this.description.equals(other.description)) - && (this.headers != null && this.headers.equals(other.headers)) + && java.util.Objects.equals(this.description, other.description) + && java.util.Objects.equals(this.headers, other.headers) && this.id() == other.id() - && (this.node != null && this.node.equals(other.node)) - && (this.parentTaskId != null && this.parentTaskId.equals(other.parentTaskId)) - && (this.runningTime != null && this.runningTime.equals(other.runningTime)) + && java.util.Objects.equals(this.node, other.node) + && java.util.Objects.equals(this.parentTaskId, other.parentTaskId) + && java.util.Objects.equals(this.runningTime, other.runningTime) && this.runningTimeInNanos() == other.runningTimeInNanos() && this.startTimeInMillis() == other.startTimeInMillis() - && (this.status != null && this.status.equals(other.status)) - && (this.type != null && this.type.equals(other.type)); + && java.util.Objects.equals(this.status, other.status) + && java.util.Objects.equals(this.type, other.type); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java index 2aa7b6d7ba..264e0a8c35 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java @@ -320,9 +320,9 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; TaskListResponseBase other = (TaskListResponseBase) o; - return (this.nodeFailures != null && this.nodeFailures.equals(other.nodeFailures)) - && (this.nodes != null && this.nodes.equals(other.nodes)) - && (this.taskFailures != null && this.taskFailures.equals(other.taskFailures)) - && (this.tasks != null && this.tasks.equals(other.tasks)); + return java.util.Objects.equals(this.nodeFailures, other.nodeFailures) + && java.util.Objects.equals(this.nodes, other.nodes) + && java.util.Objects.equals(this.taskFailures, other.taskFailures) + && java.util.Objects.equals(this.tasks, other.tasks); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java index 3ff543f127..c44b6c8916 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java @@ -748,18 +748,18 @@ public boolean equals(Object o) { if (this.getClass() != o.getClass()) return false; TaskResponse other = (TaskResponse) o; return this.batches() == other.batches() - && (this.canceled != null && this.canceled.equals(other.canceled)) + && java.util.Objects.equals(this.canceled, other.canceled) && this.created() == other.created() && this.deleted() == other.deleted() - && (this.failures != null && this.failures.equals(other.failures)) + && java.util.Objects.equals(this.failures, other.failures) && this.noops() == other.noops() && this.requestsPerSecond() == other.requestsPerSecond() - && (this.retries != null && this.retries.equals(other.retries)) + && java.util.Objects.equals(this.retries, other.retries) && this.sliceId() == other.sliceId() - && (this.slices != null && this.slices.equals(other.slices)) - && (this.throttled != null && this.throttled.equals(other.throttled)) + && java.util.Objects.equals(this.slices, other.slices) + && java.util.Objects.equals(this.throttled, other.throttled) && this.throttledMillis() == other.throttledMillis() - && (this.throttledUntil != null && this.throttledUntil.equals(other.throttledUntil)) + && java.util.Objects.equals(this.throttledUntil, other.throttledUntil) && this.throttledUntilMillis() == other.throttledUntilMillis() && this.timedOut() == other.timedOut() && this.took() == other.took() diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java index 8d522a11f1..d5f4e9a750 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java @@ -72,6 +72,7 @@ public static final class Lang { public static final class Util { public static final String PACKAGE = Java.PACKAGE + ".util"; + public static final Type Objects = Type.builder().withPackage(PACKAGE).withName("Objects").build(); public static final Type HashMap = Type.builder().withPackage(PACKAGE).withName("HashMap").build(); public static Type Map(Type keyType, Type valueType) { diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache index f3fa0a2f37..d7d40ac18b 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache @@ -13,7 +13,7 @@ this.{{name}}() == other.{{name}}() {{/isUnboxedPrimitive}} {{^isUnboxedPrimitive}} - (this.{{name}} != null && this.{{name}}.equals(other.{{name}})) + java.util.Objects.equals(this.{{name}}, other.{{name}}) {{/isUnboxedPrimitive}} {{^-last}} && From 8fd4694c6f4952e1ba2b18453b8603e23e74b514 Mon Sep 17 00:00:00 2001 From: miguel-vila Date: Fri, 20 Sep 2024 11:24:02 +0100 Subject: [PATCH 10/16] use fqn for Objects.hashCode, take into account parent Signed-off-by: miguel-vila --- .../client/opensearch/_types/BaseNode.java | 10 +++++----- .../opensearch/_types/BulkByScrollFailure.java | 10 +++++----- .../_types/BulkByScrollTaskStatus.java | 8 ++++---- .../client/opensearch/_types/ErrorCause.java | 12 ++++++------ .../client/opensearch/_types/NodeStatistics.java | 2 +- .../opensearch/_types/OpenSearchVersionInfo.java | 2 +- .../client/opensearch/_types/ShardFailure.java | 6 +++--- .../opensearch/_types/ShardStatistics.java | 2 +- .../DeleteDanglingIndexResponse.java | 2 +- .../ImportDanglingIndexResponse.java | 2 +- .../ListDanglingIndicesResponse.java | 4 ++-- .../list_dangling_indices/DanglingIndex.java | 2 +- .../opensearch/ml/DeleteModelGroupResponse.java | 2 +- .../opensearch/ml/DeleteModelResponse.java | 2 +- .../client/opensearch/ml/DeleteTaskResponse.java | 2 +- .../opensearch/ml/DeployModelResponse.java | 2 +- .../client/opensearch/ml/GetTaskResponse.java | 12 ++++++------ .../client/opensearch/ml/UndeployModelNode.java | 2 +- .../opensearch/ml/UndeployModelResponse.java | 2 +- .../client/opensearch/tasks/CancelResponse.java | 2 +- .../opensearch/tasks/GetTasksResponse.java | 4 ++-- .../client/opensearch/tasks/ListResponse.java | 2 +- .../client/opensearch/tasks/Status.java | 16 ++++++++-------- .../opensearch/tasks/TaskExecutingNode.java | 2 +- .../client/opensearch/tasks/TaskGroup.java | 4 ++-- .../client/opensearch/tasks/TaskInfo.java | 8 ++++---- .../opensearch/tasks/TaskListResponseBase.java | 8 ++++---- .../client/opensearch/tasks/TaskResponse.java | 8 ++++---- .../templates/ObjectShape/HashCode.mustache | 7 ++++++- 29 files changed, 76 insertions(+), 71 deletions(-) diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java index 7346291502..382e9b88f4 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java @@ -284,12 +284,12 @@ protected static > void setupBaseNode public int hashCode() { int result = 17; - result = 31 * result + (attributes != null ? this.attributes.hashCode() : 0); - result = 31 * result + (host != null ? this.host.hashCode() : 0); - result = 31 * result + (ip != null ? this.ip.hashCode() : 0); + result = 31 * result + java.util.Objects.hashCode(this.attributes); + result = 31 * result + java.util.Objects.hashCode(this.host); + result = 31 * result + java.util.Objects.hashCode(this.ip); result = 31 * result + this.name.hashCode(); - result = 31 * result + (roles != null ? this.roles.hashCode() : 0); - result = 31 * result + (transportAddress != null ? this.transportAddress.hashCode() : 0); + result = 31 * result + java.util.Objects.hashCode(this.roles); + result = 31 * result + java.util.Objects.hashCode(this.transportAddress); return result; } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java index 9001de4dd4..4c59014651 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java @@ -316,11 +316,11 @@ protected static void setupBulkByScrollFailureDeserializer(ObjectDeserializer public int hashCode() { int result = 17; result = 31 * result + Integer.hashCode(this.batches); - result = 31 * result + (canceled != null ? this.canceled.hashCode() : 0); + result = 31 * result + java.util.Objects.hashCode(this.canceled); result = 31 * result + Long.hashCode(this.created); result = 31 * result + Long.hashCode(this.deleted); result = 31 * result + Long.hashCode(this.noops); - result = 31 * result + (phase != null ? this.phase.hashCode() : 0); + result = 31 * result + java.util.Objects.hashCode(this.phase); result = 31 * result + Float.hashCode(this.requestsPerSecond); - result = 31 * result + (retries != null ? this.retries.hashCode() : 0); + result = 31 * result + java.util.Objects.hashCode(this.retries); result = 31 * result + Integer.hashCode(this.sliceId); - result = 31 * result + (slices != null ? this.slices.hashCode() : 0); - result = 31 * result + (state != null ? this.state.hashCode() : 0); - result = 31 * result + (throttled != null ? this.throttled.hashCode() : 0); + result = 31 * result + java.util.Objects.hashCode(this.slices); + result = 31 * result + java.util.Objects.hashCode(this.state); + result = 31 * result + java.util.Objects.hashCode(this.throttled); result = 31 * result + Long.hashCode(this.throttledMillis); - result = 31 * result + (throttledUntil != null ? this.throttledUntil.hashCode() : 0); + result = 31 * result + java.util.Objects.hashCode(this.throttledUntil); result = 31 * result + Long.hashCode(this.throttledUntilMillis); result = 31 * result + Long.hashCode(this.total); result = 31 * result + Long.hashCode(this.updated); result = 31 * result + Long.hashCode(this.versionConflicts); - result = 31 * result + (metadata != null ? this.metadata.hashCode() : 0); + result = 31 * result + java.util.Objects.hashCode(this.metadata); return result; } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java index cf7044462d..d609e19baf 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java @@ -162,7 +162,7 @@ protected static void setupTaskExecutingNodeDeserializer(ObjectDeserializer> void setupTaskList public int hashCode() { int result = 17; - result = 31 * result + (nodeFailures != null ? this.nodeFailures.hashCode() : 0); - result = 31 * result + (nodes != null ? this.nodes.hashCode() : 0); - result = 31 * result + (taskFailures != null ? this.taskFailures.hashCode() : 0); - result = 31 * result + (tasks != null ? this.tasks.hashCode() : 0); + result = 31 * result + java.util.Objects.hashCode(this.nodeFailures); + result = 31 * result + java.util.Objects.hashCode(this.nodes); + result = 31 * result + java.util.Objects.hashCode(this.taskFailures); + result = 31 * result + java.util.Objects.hashCode(this.tasks); return result; } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java index c44b6c8916..04a46a16dd 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java @@ -722,7 +722,7 @@ protected static void setupTaskResponseDeserializer(ObjectDeserializer Date: Fri, 20 Sep 2024 11:25:21 +0100 Subject: [PATCH 11/16] remove unused var definition Signed-off-by: miguel-vila --- .../DeleteDanglingIndexResponse.java | 1 - .../ImportDanglingIndexResponse.java | 1 - .../ml/DeleteModelGroupResponse.java | 1 - .../opensearch/ml/DeleteModelResponse.java | 1 - .../opensearch/ml/DeleteTaskResponse.java | 1 - .../opensearch/tasks/CancelResponse.java | 1 - .../client/opensearch/tasks/ListResponse.java | 1 - .../templates/ObjectShape/Equals.mustache | 31 +++++++++++-------- 8 files changed, 18 insertions(+), 20 deletions(-) diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexResponse.java index 59b50d34d5..0f3d499cbf 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexResponse.java @@ -113,7 +113,6 @@ public boolean equals(Object o) { } if (this == o) return true; if (this.getClass() != o.getClass()) return false; - DeleteDanglingIndexResponse other = (DeleteDanglingIndexResponse) o; return true; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexResponse.java index c1fbd03fc7..586d116d62 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexResponse.java @@ -113,7 +113,6 @@ public boolean equals(Object o) { } if (this == o) return true; if (this.getClass() != o.getClass()) return false; - ImportDanglingIndexResponse other = (ImportDanglingIndexResponse) o; return true; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupResponse.java index 29ea60b07b..5315f6739b 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupResponse.java @@ -85,7 +85,6 @@ public boolean equals(Object o) { } if (this == o) return true; if (this.getClass() != o.getClass()) return false; - DeleteModelGroupResponse other = (DeleteModelGroupResponse) o; return true; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelResponse.java index 7e9898aedd..feb2c322d6 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelResponse.java @@ -85,7 +85,6 @@ public boolean equals(Object o) { } if (this == o) return true; if (this.getClass() != o.getClass()) return false; - DeleteModelResponse other = (DeleteModelResponse) o; return true; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskResponse.java index 4c9ee644c9..ee52e15754 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskResponse.java @@ -85,7 +85,6 @@ public boolean equals(Object o) { } if (this == o) return true; if (this.getClass() != o.getClass()) return false; - DeleteTaskResponse other = (DeleteTaskResponse) o; return true; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelResponse.java index efb384f162..0f96ce30d4 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelResponse.java @@ -108,7 +108,6 @@ public boolean equals(Object o) { } if (this == o) return true; if (this.getClass() != o.getClass()) return false; - CancelResponse other = (CancelResponse) o; return true; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/ListResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/ListResponse.java index 27dc936c9f..2752f63d1c 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/ListResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/ListResponse.java @@ -108,7 +108,6 @@ public boolean equals(Object o) { } if (this == o) return true; if (this.getClass() != o.getClass()) return false; - ListResponse other = (ListResponse) o; return true; } } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache index d7d40ac18b..0545bb0a08 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache @@ -6,17 +6,22 @@ {{/extendsOtherShape}} if(this == o) return true; if(this.getClass() != o.getClass()) return false; - {{className}} other = ({{className}})o; - return {{^hasFieldsToSerialize}}true{{/hasFieldsToSerialize}} - {{#fields}} - {{#isUnboxedPrimitive}} - this.{{name}}() == other.{{name}}() - {{/isUnboxedPrimitive}} - {{^isUnboxedPrimitive}} - java.util.Objects.equals(this.{{name}}, other.{{name}}) - {{/isUnboxedPrimitive}} - {{^-last}} - && - {{/-last}} - {{/fields}}; + {{^hasFieldsToSerialize}} + return true; + {{/hasFieldsToSerialize}} + {{#hasFieldsToSerialize}} + {{className}} other = ({{className}})o; + return + {{#fields}} + {{#isUnboxedPrimitive}} + this.{{name}}() == other.{{name}}() + {{/isUnboxedPrimitive}} + {{^isUnboxedPrimitive}} + java.util.Objects.equals(this.{{name}}, other.{{name}}) + {{/isUnboxedPrimitive}} + {{^-last}} + && + {{/-last}} + {{/fields}}; + {{/hasFieldsToSerialize}} } From 6cb8df65d3eb0db969323a88f39432bb6b3023ef Mon Sep 17 00:00:00 2001 From: miguel-vila Date: Fri, 20 Sep 2024 11:28:43 +0100 Subject: [PATCH 12/16] codegen equals/hashCode for request shapes Signed-off-by: miguel-vila --- .../client/opensearch/core/InfoRequest.java | 11 ++++++++++ .../DeleteDanglingIndexRequest.java | 16 ++++++++++++++ .../ImportDanglingIndexRequest.java | 16 ++++++++++++++ .../ListDanglingIndicesRequest.java | 11 ++++++++++ .../ml/DeleteModelGroupRequest.java | 12 +++++++++++ .../opensearch/ml/DeleteModelRequest.java | 12 +++++++++++ .../opensearch/ml/DeleteTaskRequest.java | 12 +++++++++++ .../opensearch/ml/DeployModelRequest.java | 12 +++++++++++ .../opensearch/ml/GetModelGroupRequest.java | 12 +++++++++++ .../client/opensearch/ml/GetTaskRequest.java | 12 +++++++++++ .../ml/RegisterModelGroupRequest.java | 21 +++++++++++++++++++ .../opensearch/ml/RegisterModelRequest.java | 21 +++++++++++++++++++ .../opensearch/ml/UndeployModelRequest.java | 12 +++++++++++ .../opensearch/tasks/CancelRequest.java | 16 ++++++++++++++ .../opensearch/tasks/GetTasksRequest.java | 14 +++++++++++++ .../client/opensearch/tasks/ListRequest.java | 18 ++++++++++++++++ .../codegen/templates/RequestShape.mustache | 6 +++++- 17 files changed, 233 insertions(+), 1 deletion(-) diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoRequest.java index 6c9e5d2202..b40292bc51 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoRequest.java @@ -72,4 +72,15 @@ public InfoRequest() {} false, InfoResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexRequest.java index 4f6ea2ac3c..13de5ea414 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexRequest.java @@ -290,4 +290,20 @@ public DeleteDanglingIndexRequest build() { false, DeleteDanglingIndexResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + result = 31 * result + Boolean.hashCode(this.acceptDataLoss); + result = 31 * result + java.util.Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + this.indexUuid.hashCode(); + result = 31 * result + java.util.Objects.hashCode(this.masterTimeout); + result = 31 * result + java.util.Objects.hashCode(this.timeout); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexRequest.java index 4b1440b7eb..fbcd8a76e0 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexRequest.java @@ -290,4 +290,20 @@ public ImportDanglingIndexRequest build() { false, ImportDanglingIndexResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + result = 31 * result + Boolean.hashCode(this.acceptDataLoss); + result = 31 * result + java.util.Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + this.indexUuid.hashCode(); + result = 31 * result + java.util.Objects.hashCode(this.masterTimeout); + result = 31 * result + java.util.Objects.hashCode(this.timeout); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesRequest.java index 641bb9b012..5452b35c3b 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesRequest.java @@ -72,4 +72,15 @@ public ListDanglingIndicesRequest() {} false, ListDanglingIndicesResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupRequest.java index 181a605275..18c03380ce 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupRequest.java @@ -98,4 +98,16 @@ public DeleteModelGroupRequest build() { false, DeleteModelGroupResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + result = 31 * result + this.modelGroupId.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelRequest.java index f9be99c118..aae3eff81b 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelRequest.java @@ -98,4 +98,16 @@ public DeleteModelRequest build() { false, DeleteModelResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + result = 31 * result + this.modelId.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskRequest.java index a378f83fde..b8c3e3be85 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskRequest.java @@ -98,4 +98,16 @@ public DeleteTaskRequest build() { false, DeleteTaskResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + result = 31 * result + this.taskId.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelRequest.java index 2230cb1d82..8a7859958a 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelRequest.java @@ -99,4 +99,16 @@ public DeployModelRequest build() { false, DeployModelResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + result = 31 * result + this.modelId.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupRequest.java index 92c6537dc9..7098f57d27 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupRequest.java @@ -98,4 +98,16 @@ public GetModelGroupRequest build() { false, GetModelGroupResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + result = 31 * result + this.modelGroupId.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskRequest.java index 55f09a5df6..ab01a433b4 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskRequest.java @@ -98,4 +98,16 @@ public GetTaskRequest build() { false, GetTaskResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + result = 31 * result + this.taskId.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupRequest.java index 2cf102fca7..119cd26193 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupRequest.java @@ -294,4 +294,25 @@ protected static void setupRegisterModelGroupRequestDeserializer(ObjectDeseriali true, RegisterModelGroupResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + result = 31 * result + java.util.Objects.hashCode(this.accessMode); + result = 31 * result + Boolean.hashCode(this.addAllBackendRoles); + result = 31 * result + java.util.Objects.hashCode(this.backendRoles); + result = 31 * result + java.util.Objects.hashCode(this.description); + result = 31 * result + this.name.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + RegisterModelGroupRequest other = (RegisterModelGroupRequest) o; + return java.util.Objects.equals(this.accessMode, other.accessMode) + && this.addAllBackendRoles() == other.addAllBackendRoles() + && java.util.Objects.equals(this.backendRoles, other.backendRoles) + && java.util.Objects.equals(this.description, other.description) + && java.util.Objects.equals(this.name, other.name); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java index 98fb7909fd..bfe1b2900e 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java @@ -262,4 +262,25 @@ protected static void setupRegisterModelRequestDeserializer(ObjectDeserializerObjectShape/HashCode}} + + {{>ObjectShape/Equals}} +} From a7a53e26ec5ad254c4ac325fbcaa84a2ca43bfdc Mon Sep 17 00:00:00 2001 From: miguel-vila Date: Fri, 20 Sep 2024 11:48:04 +0100 Subject: [PATCH 13/16] add hashCode/equals to TaggedUnion Signed-off-by: miguel-vila --- .../_types/BulkByScrollTaskStatusOrException.java | 15 +++++++++++++++ .../client/opensearch/tasks/TaskInfos.java | 15 +++++++++++++++ .../ObjectShape/TaggedUnionEquals.mustache | 6 ++++++ .../ObjectShape/TaggedUnionHashCode.mustache | 6 ++++++ .../codegen/templates/TaggedUnionShape.mustache | 5 +++++ 5 files changed, 47 insertions(+) create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/TaggedUnionEquals.mustache create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/TaggedUnionHashCode.mustache diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatusOrException.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatusOrException.java index 10d8cd24cb..e2425568f6 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatusOrException.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatusOrException.java @@ -175,4 +175,19 @@ private static JsonpDeserializer buildBulkByS public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy( BulkByScrollTaskStatusOrException::buildBulkByScrollTaskStatusOrExceptionDeserializer ); + + public int hashCode() { + int result = 17; + result = 31 * result + _kind.hashCode(); + result = 31 * result + _value.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + BulkByScrollTaskStatusOrException other = (BulkByScrollTaskStatusOrException) o; + return this._kind().equals(other._kind()) && this._get().equals(other._get()); + } + } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfos.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfos.java index 9e394d3d7a..aeb0c0e298 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfos.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfos.java @@ -160,4 +160,19 @@ private static JsonpDeserializer buildTaskInfosDeserializer() { } public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy(TaskInfos::buildTaskInfosDeserializer); + + public int hashCode() { + int result = 17; + result = 31 * result + _kind.hashCode(); + result = 31 * result + _value.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + TaskInfos other = (TaskInfos) o; + return this._kind().equals(other._kind()) && this._get().equals(other._get()); + } + } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/TaggedUnionEquals.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/TaggedUnionEquals.mustache new file mode 100644 index 0000000000..7a368dc538 --- /dev/null +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/TaggedUnionEquals.mustache @@ -0,0 +1,6 @@ + public boolean equals(Object o) { + if(this == o) return true; + if(this.getClass() != o.getClass()) return false; + {{className}} other = ({{className}})o; + return this._kind().equals(other._kind()) && this._get().equals(other._get()); + } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/TaggedUnionHashCode.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/TaggedUnionHashCode.mustache new file mode 100644 index 0000000000..8cd7137529 --- /dev/null +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/TaggedUnionHashCode.mustache @@ -0,0 +1,6 @@ + public int hashCode() { + int result = 17; + result = 31 * result + _kind.hashCode(); + result = 31 * result + _value.hashCode(); + return result; + } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache index 236daf9abb..c59a635d39 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache @@ -111,4 +111,9 @@ } public static final {{TYPES.Client.Json.JsonpDeserializer}}<{{className}}> _DESERIALIZER = {{TYPES.Client.Json.JsonpDeserializer}}.lazy({{className}}::build{{className}}Deserializer); + + {{>ObjectShape/TaggedUnionHashCode}} + + {{>ObjectShape/TaggedUnionEquals}} + } From 2e87b0a96f464b5900f8ea6de5cb1b1e972778b9 Mon Sep 17 00:00:00 2001 From: miguel-vila Date: Mon, 23 Sep 2024 09:53:41 +0100 Subject: [PATCH 14/16] use import Signed-off-by: miguel-vila --- .../client/opensearch/_types/BaseNode.java | 23 ++++++------- .../_types/BulkByScrollFailure.java | 21 ++++++------ .../_types/BulkByScrollTaskStatus.java | 19 ++++++----- .../client/opensearch/_types/ErrorCause.java | 27 +++++++-------- .../opensearch/_types/NodeStatistics.java | 5 +-- .../_types/OpenSearchVersionInfo.java | 21 ++++++------ .../opensearch/_types/ShardFailure.java | 15 +++++---- .../opensearch/_types/ShardStatistics.java | 5 +-- .../client/opensearch/_types/TaskFailure.java | 7 ++-- .../opensearch/_types/WriteResponseBase.java | 9 ++--- .../client/opensearch/core/InfoResponse.java | 11 ++++--- .../DeleteDanglingIndexRequest.java | 7 ++-- .../ImportDanglingIndexRequest.java | 7 ++-- .../ListDanglingIndicesResponse.java | 11 ++++--- .../list_dangling_indices/DanglingIndex.java | 11 ++++--- .../opensearch/ml/DeployModelResponse.java | 9 ++--- .../opensearch/ml/GetModelGroupResponse.java | 7 ++-- .../client/opensearch/ml/GetTaskResponse.java | 27 +++++++-------- .../ml/RegisterModelGroupRequest.java | 15 +++++---- .../ml/RegisterModelGroupResponse.java | 3 +- .../opensearch/ml/RegisterModelRequest.java | 15 +++++---- .../opensearch/ml/RegisterModelResponse.java | 3 +- .../opensearch/ml/UndeployModelNode.java | 5 +-- .../opensearch/ml/UndeployModelResponse.java | 5 +-- .../opensearch/tasks/CancelRequest.java | 9 ++--- .../opensearch/tasks/GetTasksRequest.java | 3 +- .../opensearch/tasks/GetTasksResponse.java | 11 ++++--- .../client/opensearch/tasks/ListRequest.java | 11 ++++--- .../client/opensearch/tasks/Status.java | 33 ++++++++++--------- .../opensearch/tasks/TaskExecutingNode.java | 3 +- .../client/opensearch/tasks/TaskGroup.java | 5 +-- .../client/opensearch/tasks/TaskInfo.java | 25 +++++++------- .../tasks/TaskListResponseBase.java | 17 +++++----- .../client/opensearch/tasks/TaskResponse.java | 21 ++++++------ .../templates/ObjectShape/Equals.mustache | 2 +- .../templates/ObjectShape/HashCode.mustache | 2 +- 36 files changed, 232 insertions(+), 198 deletions(-) diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java index 382e9b88f4..bcd4083925 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java @@ -39,6 +39,7 @@ import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.Map; +import java.util.Objects; import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializer; @@ -284,12 +285,12 @@ protected static > void setupBaseNode public int hashCode() { int result = 17; - result = 31 * result + java.util.Objects.hashCode(this.attributes); - result = 31 * result + java.util.Objects.hashCode(this.host); - result = 31 * result + java.util.Objects.hashCode(this.ip); + result = 31 * result + Objects.hashCode(this.attributes); + result = 31 * result + Objects.hashCode(this.host); + result = 31 * result + Objects.hashCode(this.ip); result = 31 * result + this.name.hashCode(); - result = 31 * result + java.util.Objects.hashCode(this.roles); - result = 31 * result + java.util.Objects.hashCode(this.transportAddress); + result = 31 * result + Objects.hashCode(this.roles); + result = 31 * result + Objects.hashCode(this.transportAddress); return result; } @@ -297,11 +298,11 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; BaseNode other = (BaseNode) o; - return java.util.Objects.equals(this.attributes, other.attributes) - && java.util.Objects.equals(this.host, other.host) - && java.util.Objects.equals(this.ip, other.ip) - && java.util.Objects.equals(this.name, other.name) - && java.util.Objects.equals(this.roles, other.roles) - && java.util.Objects.equals(this.transportAddress, other.transportAddress); + return Objects.equals(this.attributes, other.attributes) + && Objects.equals(this.host, other.host) + && Objects.equals(this.ip, other.ip) + && Objects.equals(this.name, other.name) + && Objects.equals(this.roles, other.roles) + && Objects.equals(this.transportAddress, other.transportAddress); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java index 4c59014651..d3993eacfb 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java @@ -37,6 +37,7 @@ package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -316,11 +317,11 @@ protected static void setupBulkByScrollFailureDeserializer(ObjectDeserializer public int hashCode() { int result = 17; result = 31 * result + Integer.hashCode(this.batches); - result = 31 * result + java.util.Objects.hashCode(this.canceled); + result = 31 * result + Objects.hashCode(this.canceled); result = 31 * result + Long.hashCode(this.created); result = 31 * result + Long.hashCode(this.deleted); result = 31 * result + Long.hashCode(this.noops); - result = 31 * result + java.util.Objects.hashCode(this.phase); + result = 31 * result + Objects.hashCode(this.phase); result = 31 * result + Float.hashCode(this.requestsPerSecond); - result = 31 * result + java.util.Objects.hashCode(this.retries); + result = 31 * result + Objects.hashCode(this.retries); result = 31 * result + Integer.hashCode(this.sliceId); - result = 31 * result + java.util.Objects.hashCode(this.slices); - result = 31 * result + java.util.Objects.hashCode(this.state); - result = 31 * result + java.util.Objects.hashCode(this.throttled); + result = 31 * result + Objects.hashCode(this.slices); + result = 31 * result + Objects.hashCode(this.state); + result = 31 * result + Objects.hashCode(this.throttled); result = 31 * result + Long.hashCode(this.throttledMillis); - result = 31 * result + java.util.Objects.hashCode(this.throttledUntil); + result = 31 * result + Objects.hashCode(this.throttledUntil); result = 31 * result + Long.hashCode(this.throttledUntilMillis); result = 31 * result + Long.hashCode(this.total); result = 31 * result + Long.hashCode(this.updated); result = 31 * result + Long.hashCode(this.versionConflicts); - result = 31 * result + java.util.Objects.hashCode(this.metadata); + result = 31 * result + Objects.hashCode(this.metadata); return result; } @@ -797,23 +798,23 @@ public boolean equals(Object o) { if (this.getClass() != o.getClass()) return false; Status other = (Status) o; return this.batches() == other.batches() - && java.util.Objects.equals(this.canceled, other.canceled) + && Objects.equals(this.canceled, other.canceled) && this.created() == other.created() && this.deleted() == other.deleted() && this.noops() == other.noops() - && java.util.Objects.equals(this.phase, other.phase) + && Objects.equals(this.phase, other.phase) && this.requestsPerSecond() == other.requestsPerSecond() - && java.util.Objects.equals(this.retries, other.retries) + && Objects.equals(this.retries, other.retries) && this.sliceId() == other.sliceId() - && java.util.Objects.equals(this.slices, other.slices) - && java.util.Objects.equals(this.state, other.state) - && java.util.Objects.equals(this.throttled, other.throttled) + && Objects.equals(this.slices, other.slices) + && Objects.equals(this.state, other.state) + && Objects.equals(this.throttled, other.throttled) && this.throttledMillis() == other.throttledMillis() - && java.util.Objects.equals(this.throttledUntil, other.throttledUntil) + && Objects.equals(this.throttledUntil, other.throttledUntil) && this.throttledUntilMillis() == other.throttledUntilMillis() && this.total() == other.total() && this.updated() == other.updated() && this.versionConflicts() == other.versionConflicts() - && java.util.Objects.equals(this.metadata, other.metadata); + && Objects.equals(this.metadata, other.metadata); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java index d609e19baf..7a9d77716f 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java @@ -38,6 +38,7 @@ import jakarta.json.stream.JsonGenerator; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; @@ -174,6 +175,6 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; TaskExecutingNode other = (TaskExecutingNode) o; - return java.util.Objects.equals(this.tasks, other.tasks); + return Objects.equals(this.tasks, other.tasks); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskGroup.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskGroup.java index 9244975a56..dff52c8dcc 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskGroup.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskGroup.java @@ -38,6 +38,7 @@ import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -165,7 +166,7 @@ protected static void setupTaskGroupDeserializer(ObjectDeserializer> void setupTaskList public int hashCode() { int result = 17; - result = 31 * result + java.util.Objects.hashCode(this.nodeFailures); - result = 31 * result + java.util.Objects.hashCode(this.nodes); - result = 31 * result + java.util.Objects.hashCode(this.taskFailures); - result = 31 * result + java.util.Objects.hashCode(this.tasks); + result = 31 * result + Objects.hashCode(this.nodeFailures); + result = 31 * result + Objects.hashCode(this.nodes); + result = 31 * result + Objects.hashCode(this.taskFailures); + result = 31 * result + Objects.hashCode(this.tasks); return result; } @@ -320,9 +321,9 @@ public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; TaskListResponseBase other = (TaskListResponseBase) o; - return java.util.Objects.equals(this.nodeFailures, other.nodeFailures) - && java.util.Objects.equals(this.nodes, other.nodes) - && java.util.Objects.equals(this.taskFailures, other.taskFailures) - && java.util.Objects.equals(this.tasks, other.tasks); + return Objects.equals(this.nodeFailures, other.nodeFailures) + && Objects.equals(this.nodes, other.nodes) + && Objects.equals(this.taskFailures, other.taskFailures) + && Objects.equals(this.tasks, other.tasks); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java index 04a46a16dd..c737e57217 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java @@ -38,6 +38,7 @@ import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -722,7 +723,7 @@ protected static void setupTaskResponseDeserializer(ObjectDeserializer Date: Mon, 23 Sep 2024 10:14:28 +0100 Subject: [PATCH 15/16] fix equals for request shapes Signed-off-by: miguel-vila --- .../dangling_indices/DeleteDanglingIndexRequest.java | 7 ++++++- .../dangling_indices/ImportDanglingIndexRequest.java | 7 ++++++- .../client/opensearch/ml/DeleteModelGroupRequest.java | 4 +++- .../client/opensearch/ml/DeleteModelRequest.java | 4 +++- .../client/opensearch/ml/DeleteTaskRequest.java | 4 +++- .../client/opensearch/ml/DeployModelRequest.java | 4 +++- .../client/opensearch/ml/GetModelGroupRequest.java | 4 +++- .../opensearch/client/opensearch/ml/GetTaskRequest.java | 4 +++- .../client/opensearch/ml/UndeployModelRequest.java | 4 +++- .../client/opensearch/tasks/CancelRequest.java | 7 ++++++- .../client/opensearch/tasks/GetTasksRequest.java | 5 ++++- .../opensearch/client/opensearch/tasks/ListRequest.java | 9 ++++++++- .../org/opensearch/client/codegen/model/ObjectShape.java | 4 ++++ .../opensearch/client/codegen/model/RequestShape.java | 4 ++++ .../client/codegen/templates/ObjectShape/Equals.mustache | 8 ++++---- 15 files changed, 63 insertions(+), 16 deletions(-) diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexRequest.java index 75f28c0b7d..dc91b68c39 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexRequest.java @@ -305,6 +305,11 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; - return true; + DeleteDanglingIndexRequest other = (DeleteDanglingIndexRequest) o; + return this.acceptDataLoss() == other.acceptDataLoss() + && Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.indexUuid, other.indexUuid) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.timeout, other.timeout); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexRequest.java index f9790ba1d0..127d1763b8 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexRequest.java @@ -305,6 +305,11 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; - return true; + ImportDanglingIndexRequest other = (ImportDanglingIndexRequest) o; + return this.acceptDataLoss() == other.acceptDataLoss() + && Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.indexUuid, other.indexUuid) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.timeout, other.timeout); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupRequest.java index 18c03380ce..7575637baf 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupRequest.java @@ -12,6 +12,7 @@ package org.opensearch.client.opensearch.ml; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import org.opensearch.client.opensearch._types.ErrorResponse; @@ -108,6 +109,7 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; - return true; + DeleteModelGroupRequest other = (DeleteModelGroupRequest) o; + return Objects.equals(this.modelGroupId, other.modelGroupId); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelRequest.java index aae3eff81b..f14d9eb0cd 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelRequest.java @@ -12,6 +12,7 @@ package org.opensearch.client.opensearch.ml; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import org.opensearch.client.opensearch._types.ErrorResponse; @@ -108,6 +109,7 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; - return true; + DeleteModelRequest other = (DeleteModelRequest) o; + return Objects.equals(this.modelId, other.modelId); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskRequest.java index b8c3e3be85..9620b90898 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskRequest.java @@ -12,6 +12,7 @@ package org.opensearch.client.opensearch.ml; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import org.opensearch.client.opensearch._types.ErrorResponse; @@ -108,6 +109,7 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; - return true; + DeleteTaskRequest other = (DeleteTaskRequest) o; + return Objects.equals(this.taskId, other.taskId); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelRequest.java index 8a7859958a..dc823dd744 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelRequest.java @@ -12,6 +12,7 @@ package org.opensearch.client.opensearch.ml; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import org.opensearch.client.opensearch._types.ErrorResponse; @@ -109,6 +110,7 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; - return true; + DeployModelRequest other = (DeployModelRequest) o; + return Objects.equals(this.modelId, other.modelId); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupRequest.java index 7098f57d27..bdeefc9137 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupRequest.java @@ -12,6 +12,7 @@ package org.opensearch.client.opensearch.ml; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import org.opensearch.client.opensearch._types.ErrorResponse; @@ -108,6 +109,7 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; - return true; + GetModelGroupRequest other = (GetModelGroupRequest) o; + return Objects.equals(this.modelGroupId, other.modelGroupId); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskRequest.java index ab01a433b4..76dbbc8352 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskRequest.java @@ -12,6 +12,7 @@ package org.opensearch.client.opensearch.ml; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import org.opensearch.client.opensearch._types.ErrorResponse; @@ -108,6 +109,7 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; - return true; + GetTaskRequest other = (GetTaskRequest) o; + return Objects.equals(this.taskId, other.taskId); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelRequest.java index 094f5406f5..0b9f760371 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelRequest.java @@ -12,6 +12,7 @@ package org.opensearch.client.opensearch.ml; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import org.opensearch.client.opensearch._types.ErrorResponse; @@ -109,6 +110,7 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; - return true; + UndeployModelRequest other = (UndeployModelRequest) o; + return Objects.equals(this.modelId, other.modelId); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelRequest.java index 93bd226dcd..383f28b8eb 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelRequest.java @@ -325,6 +325,11 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; - return true; + CancelRequest other = (CancelRequest) o; + return Objects.equals(this.actions, other.actions) + && Objects.equals(this.nodes, other.nodes) + && Objects.equals(this.parentTaskId, other.parentTaskId) + && Objects.equals(this.taskId, other.taskId) + && this.waitForCompletion() == other.waitForCompletion(); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksRequest.java index 377b5f06e0..2c27e75efc 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksRequest.java @@ -220,6 +220,9 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; - return true; + GetTasksRequest other = (GetTasksRequest) o; + return Objects.equals(this.taskId, other.taskId) + && Objects.equals(this.timeout, other.timeout) + && this.waitForCompletion() == other.waitForCompletion(); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/ListRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/ListRequest.java index f6b49ef874..fef278d750 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/ListRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/ListRequest.java @@ -387,6 +387,13 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (this.getClass() != o.getClass()) return false; - return true; + ListRequest other = (ListRequest) o; + return Objects.equals(this.actions, other.actions) + && this.detailed() == other.detailed() + && Objects.equals(this.groupBy, other.groupBy) + && Objects.equals(this.nodes, other.nodes) + && Objects.equals(this.parentTaskId, other.parentTaskId) + && Objects.equals(this.timeout, other.timeout) + && this.waitForCompletion() == other.waitForCompletion(); } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/ObjectShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/ObjectShape.java index 75b82438f1..32ba374de0 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/ObjectShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/ObjectShape.java @@ -55,6 +55,10 @@ public boolean hasFieldsToSerialize() { return !bodyFields.isEmpty() || additionalPropertiesField != null; } + public boolean hasFields() { + return !bodyFields.isEmpty() || additionalPropertiesField != null; + } + public Collection getImplementsTypes() { return hasFieldsToSerialize() && !extendsOtherShape() ? List.of(Types.Client.Json.PlainJsonSerializable) : null; } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java index 18facfd53e..d76a67d2fe 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java @@ -151,6 +151,10 @@ public boolean hasAnyRequiredFields() { return fields.values().stream().anyMatch(Field::isRequired); } + public boolean hasFields() { + return !fields.isEmpty(); + } + public Type getJsonEndpointType() { return Types.Client.Transport.JsonEndpoint(getType(), getResponseType(), Types.Client.OpenSearch._Types.ErrorResponse); } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache index 8549a77e9c..6e45e22d72 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache @@ -6,10 +6,10 @@ {{/extendsOtherShape}} if(this == o) return true; if(this.getClass() != o.getClass()) return false; - {{^hasFieldsToSerialize}} + {{^hasFields}} return true; - {{/hasFieldsToSerialize}} - {{#hasFieldsToSerialize}} + {{/hasFields}} + {{#hasFields}} {{className}} other = ({{className}})o; return {{#fields}} @@ -23,5 +23,5 @@ && {{/-last}} {{/fields}}; - {{/hasFieldsToSerialize}} + {{/hasFields}} } From cd233bee0a549f483099a41d9a0c62b5e7118f1c Mon Sep 17 00:00:00 2001 From: miguel-vila Date: Mon, 23 Sep 2024 10:25:08 +0100 Subject: [PATCH 16/16] codegen latest from main Signed-off-by: miguel-vila --- .../client/opensearch/ml/Action.java | 26 +++++++++++++++++ .../client/opensearch/ml/ClientConfig.java | 26 +++++++++++++++++ .../opensearch/ml/CreateConnectorRequest.java | 28 +++++++++++++++++++ .../ml/CreateConnectorResponse.java | 14 ++++++++++ .../client/opensearch/ml/Credential.java | 20 +++++++++++++ .../opensearch/ml/DeleteAgentRequest.java | 14 ++++++++++ .../opensearch/ml/DeleteAgentResponse.java | 14 ++++++++++ .../opensearch/ml/DeleteConnectorRequest.java | 14 ++++++++++ .../ml/DeleteConnectorResponse.java | 14 ++++++++++ .../client/opensearch/ml/Headers.java | 15 ++++++++++ .../opensearch/client/opensearch/ml/LLM.java | 15 ++++++++++ .../client/opensearch/ml/Memory.java | 14 ++++++++++ .../opensearch/ml/RegisterAgentsRequest.java | 28 +++++++++++++++++++ .../opensearch/ml/RegisterAgentsResponse.java | 14 ++++++++++ .../client/opensearch/ml/ToolItems.java | 20 +++++++++++++ 15 files changed, 276 insertions(+) diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Action.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Action.java index e9912634cc..68e20bc646 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Action.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Action.java @@ -13,6 +13,7 @@ package org.opensearch.client.opensearch.ml; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -286,4 +287,29 @@ protected static void setupActionDeserializer(ObjectDeserializer op.add(Builder::requestBody, JsonpDeserializer.stringDeserializer(), "request_body"); op.add(Builder::url, JsonpDeserializer.stringDeserializer(), "url"); } + + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.actionType); + result = 31 * result + Objects.hashCode(this.headers); + result = 31 * result + Objects.hashCode(this.method); + result = 31 * result + Objects.hashCode(this.postProcessFunction); + result = 31 * result + Objects.hashCode(this.preProcessFunction); + result = 31 * result + Objects.hashCode(this.requestBody); + result = 31 * result + Objects.hashCode(this.url); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + Action other = (Action) o; + return Objects.equals(this.actionType, other.actionType) + && Objects.equals(this.headers, other.headers) + && Objects.equals(this.method, other.method) + && Objects.equals(this.postProcessFunction, other.postProcessFunction) + && Objects.equals(this.preProcessFunction, other.preProcessFunction) + && Objects.equals(this.requestBody, other.requestBody) + && Objects.equals(this.url, other.url); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ClientConfig.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ClientConfig.java index e3907e7f59..0a3fa1a853 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ClientConfig.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ClientConfig.java @@ -13,6 +13,7 @@ package org.opensearch.client.opensearch.ml; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -279,4 +280,29 @@ protected static void setupClientConfigDeserializer(ObjectDeserializer op) { op.add(Builder::connectorId, JsonpDeserializer.stringDeserializer(), "connector_id"); } + + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.connectorId); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + CreateConnectorResponse other = (CreateConnectorResponse) o; + return Objects.equals(this.connectorId, other.connectorId); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Credential.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Credential.java index 8e32830e5e..1e465e9f59 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Credential.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Credential.java @@ -15,6 +15,7 @@ import jakarta.json.stream.JsonGenerator; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -214,4 +215,23 @@ protected static void setupCredentialDeserializer(ObjectDeserializer op) { WriteResponseBase.setupWriteResponseBaseDeserializer(op); } + + public int hashCode() { + int result = super.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorRequest.java index 30e0f7d202..b108f9b63e 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorRequest.java @@ -12,6 +12,7 @@ package org.opensearch.client.opensearch.ml; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import org.opensearch.client.opensearch._types.ErrorResponse; @@ -98,4 +99,17 @@ public DeleteConnectorRequest build() { false, DeleteConnectorResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + result = 31 * result + this.connectorId.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + DeleteConnectorRequest other = (DeleteConnectorRequest) o; + return Objects.equals(this.connectorId, other.connectorId); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorResponse.java index 1ba0900cc8..9119d195e6 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorResponse.java @@ -73,4 +73,18 @@ public DeleteConnectorResponse build() { protected static void setupDeleteConnectorResponseDeserializer(ObjectDeserializer op) { WriteResponseBase.setupWriteResponseBaseDeserializer(op); } + + public int hashCode() { + int result = super.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Headers.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Headers.java index 837e3b4332..bfa7ee502a 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Headers.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Headers.java @@ -15,6 +15,7 @@ import jakarta.json.stream.JsonGenerator; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -158,4 +159,18 @@ protected static void setupHeadersDeserializer(ObjectDeserializer op) { op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); op.add(Builder::parameters, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "parameters"); } + + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.modelId); + result = 31 * result + Objects.hashCode(this.parameters); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + LLM other = (LLM) o; + return Objects.equals(this.modelId, other.modelId) && Objects.equals(this.parameters, other.parameters); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Memory.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Memory.java index dfc0a9083c..3ae6dcaf1e 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Memory.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Memory.java @@ -13,6 +13,7 @@ package org.opensearch.client.opensearch.ml; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -111,4 +112,17 @@ public Memory build() { protected static void setupMemoryDeserializer(ObjectDeserializer op) { op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); } + + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.type); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + Memory other = (Memory) o; + return Objects.equals(this.type, other.type); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsRequest.java index 155e0de881..1924edac77 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsRequest.java @@ -15,6 +15,7 @@ import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -386,4 +387,31 @@ protected static void setupRegisterAgentsRequestDeserializer(ObjectDeserializer< true, RegisterAgentsResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.appType); + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + Objects.hashCode(this.llm); + result = 31 * result + Objects.hashCode(this.memory); + result = 31 * result + this.name.hashCode(); + result = 31 * result + Objects.hashCode(this.parameters); + result = 31 * result + Objects.hashCode(this.tools); + result = 31 * result + this.type.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + RegisterAgentsRequest other = (RegisterAgentsRequest) o; + return Objects.equals(this.appType, other.appType) + && Objects.equals(this.description, other.description) + && Objects.equals(this.llm, other.llm) + && Objects.equals(this.memory, other.memory) + && Objects.equals(this.name, other.name) + && Objects.equals(this.parameters, other.parameters) + && Objects.equals(this.tools, other.tools) + && Objects.equals(this.type, other.type); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsResponse.java index e69ff9e0de..199ae5fde6 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsResponse.java @@ -13,6 +13,7 @@ package org.opensearch.client.opensearch.ml; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -111,4 +112,17 @@ public RegisterAgentsResponse build() { protected static void setupRegisterAgentsResponseDeserializer(ObjectDeserializer op) { op.add(Builder::agentId, JsonpDeserializer.stringDeserializer(), "agent_id"); } + + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.agentId); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + RegisterAgentsResponse other = (RegisterAgentsResponse) o; + return Objects.equals(this.agentId, other.agentId); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ToolItems.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ToolItems.java index b52d7fae3a..65f076a93d 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ToolItems.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ToolItems.java @@ -15,6 +15,7 @@ import jakarta.json.stream.JsonGenerator; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -233,4 +234,23 @@ protected static void setupToolItemsDeserializer(ObjectDeserializer