Skip to content

Commit

Permalink
Improve null handling
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia committed Oct 1, 2024
1 parent 162a364 commit 3c0a405
Show file tree
Hide file tree
Showing 93 changed files with 644 additions and 386 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ public int hashCode() {

public boolean equals(Object o) {
if (this == o) return true;
if (this.getClass() != o.getClass()) return false;
if (o == null || this.getClass() != o.getClass()) return false;
AcknowledgedResponseBase other = (AcknowledgedResponseBase) o;
return this.acknowledged() == other.acknowledged();
return this.acknowledged == other.acknowledged;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.util.Map;
import java.util.Objects;
import javax.annotation.Generated;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
Expand All @@ -54,6 +55,7 @@
@Generated("org.opensearch.client.codegen.CodeGenerator")
public abstract class BaseNode implements PlainJsonSerializable {

@Nonnull
private final Map<String, String> attributes;

@Nullable
Expand All @@ -62,8 +64,10 @@ public abstract class BaseNode implements PlainJsonSerializable {
@Nullable
private final String ip;

@Nonnull
private final String name;

@Nonnull
private final List<NodeRole> roles;

@Nullable
Expand All @@ -83,6 +87,7 @@ protected BaseNode(AbstractBuilder<?> builder) {
/**
* API name: {@code attributes}
*/
@Nonnull
public final Map<String, String> attributes() {
return this.attributes;
}
Expand All @@ -106,13 +111,15 @@ public final String ip() {
/**
* Required - API name: {@code name}
*/
@Nonnull
public final String name() {
return this.name;
}

/**
* API name: {@code roles}
*/
@Nonnull
public final List<NodeRole> roles() {
return this.roles;
}
Expand Down Expand Up @@ -296,12 +303,12 @@ public int hashCode() {

public boolean equals(Object o) {
if (this == o) return true;
if (this.getClass() != o.getClass()) return false;
if (o == null || this.getClass() != o.getClass()) return false;
BaseNode other = (BaseNode) o;
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)
&& this.name.equals(other.name)
&& Objects.equals(this.roles, other.roles)
&& Objects.equals(this.transportAddress, other.transportAddress);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,21 +322,21 @@ public int hashCode() {
result = 31 * result + Objects.hashCode(this.index);
result = 31 * result + Objects.hashCode(this.node);
result = 31 * result + Objects.hashCode(this.reason);
result = 31 * result + Integer.hashCode(this.shard);
result = 31 * result + Objects.hashCode(this.shard);
result = 31 * result + Integer.hashCode(this.status);
return result;
}

public boolean equals(Object o) {
if (this == o) return true;
if (this.getClass() != o.getClass()) return false;
if (o == null || this.getClass() != o.getClass()) return false;
BulkByScrollFailure other = (BulkByScrollFailure) o;
return Objects.equals(this.cause, other.cause)
&& Objects.equals(this.id, other.id)
&& Objects.equals(this.index, other.index)
&& Objects.equals(this.node, other.node)
&& Objects.equals(this.reason, other.reason)
&& this.shard() == other.shard()
&& this.status() == other.status();
&& Objects.equals(this.shard, other.shard)
&& this.status == other.status;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.util.Objects;
import java.util.function.Function;
import javax.annotation.Generated;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
Expand Down Expand Up @@ -72,11 +73,13 @@ public class BulkByScrollTaskStatus implements PlainJsonSerializable {

private final float requestsPerSecond;

@Nonnull
private final Retries retries;

@Nullable
private final Integer sliceId;

@Nonnull
private final List<BulkByScrollTaskStatusOrException> slices;

@Nullable
Expand Down Expand Up @@ -183,6 +186,7 @@ public final float requestsPerSecond() {
/**
* Required - API name: {@code retries}
*/
@Nonnull
public final Retries retries() {
return this.retries;
}
Expand All @@ -198,6 +202,7 @@ public final Integer sliceId() {
/**
* API name: {@code slices}
*/
@Nonnull
public final List<BulkByScrollTaskStatusOrException> slices() {
return this.slices;
}
Expand Down Expand Up @@ -620,42 +625,42 @@ public int hashCode() {
int result = 17;
result = 31 * result + Integer.hashCode(this.batches);
result = 31 * result + Objects.hashCode(this.canceled);
result = 31 * result + Long.hashCode(this.created);
result = 31 * result + Objects.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 + Integer.hashCode(this.sliceId);
result = 31 * result + Objects.hashCode(this.sliceId);
result = 31 * result + Objects.hashCode(this.slices);
result = 31 * result + Objects.hashCode(this.throttled);
result = 31 * result + Long.hashCode(this.throttledMillis);
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 + Objects.hashCode(this.updated);
result = 31 * result + Long.hashCode(this.versionConflicts);
return result;
}

public boolean equals(Object o) {
if (this == o) return true;
if (this.getClass() != o.getClass()) return false;
if (o == null || this.getClass() != o.getClass()) return false;
BulkByScrollTaskStatus other = (BulkByScrollTaskStatus) o;
return this.batches() == other.batches()
return this.batches == other.batches
&& Objects.equals(this.canceled, other.canceled)
&& this.created() == other.created()
&& this.deleted() == other.deleted()
&& this.noops() == other.noops()
&& this.requestsPerSecond() == other.requestsPerSecond()
&& Objects.equals(this.retries, other.retries)
&& this.sliceId() == other.sliceId()
&& Objects.equals(this.created, other.created)
&& this.deleted == other.deleted
&& this.noops == other.noops
&& this.requestsPerSecond == other.requestsPerSecond
&& this.retries.equals(other.retries)
&& Objects.equals(this.sliceId, other.sliceId)
&& Objects.equals(this.slices, other.slices)
&& Objects.equals(this.throttled, other.throttled)
&& this.throttledMillis() == other.throttledMillis()
&& this.throttledMillis == other.throttledMillis
&& Objects.equals(this.throttledUntil, other.throttledUntil)
&& this.throttledUntilMillis() == other.throttledUntilMillis()
&& this.total() == other.total()
&& this.updated() == other.updated()
&& this.versionConflicts() == other.versionConflicts();
&& this.throttledUntilMillis == other.throttledUntilMillis
&& this.total == other.total
&& Objects.equals(this.updated, other.updated)
&& this.versionConflicts == other.versionConflicts;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 org.opensearch.client.json.JsonpDeserializable;
Expand Down Expand Up @@ -178,16 +179,15 @@ private static JsonpDeserializer<BulkByScrollTaskStatusOrException> buildBulkByS

public int hashCode() {
int result = 17;
result = 31 * result + _kind.hashCode();
result = 31 * result + _value.hashCode();
result = 31 * result + Objects.hashCode(this._kind);
result = 31 * result + Objects.hashCode(this._value);
return result;
}

public boolean equals(Object o) {
if (this == o) return true;
if (this.getClass() != o.getClass()) return false;
if (o == null || this.getClass() != o.getClass()) return false;
BulkByScrollTaskStatusOrException other = (BulkByScrollTaskStatusOrException) o;
return this._kind().equals(other._kind()) && this._get().equals(other._get());
return Objects.equals(this._kind, other._kind) && Objects.equals(this._get, other._get);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import java.util.Objects;
import java.util.function.Function;
import javax.annotation.Generated;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opensearch.client.json.JsonData;
import org.opensearch.client.json.JsonpDeserializable;
Expand All @@ -67,15 +68,19 @@ public class ErrorCause implements PlainJsonSerializable {
@Nullable
private final String reason;

@Nonnull
private final List<ErrorCause> rootCause;

@Nullable
private final String stackTrace;

@Nonnull
private final List<ErrorCause> suppressed;

@Nonnull
private final String type;

@Nonnull
private final Map<String, JsonData> metadata;

// ---------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -116,6 +121,7 @@ public final String reason() {
/**
* API name: {@code root_cause}
*/
@Nonnull
public final List<ErrorCause> rootCause() {
return this.rootCause;
}
Expand All @@ -134,6 +140,7 @@ public final String stackTrace() {
/**
* API name: {@code suppressed}
*/
@Nonnull
public final List<ErrorCause> suppressed() {
return this.suppressed;
}
Expand All @@ -144,13 +151,15 @@ public final List<ErrorCause> suppressed() {
* API name: {@code type}
* </p>
*/
@Nonnull
public final String type() {
return this.type;
}

/**
* Additional details about the error.
*/
@Nonnull
public final Map<String, JsonData> metadata() {
return this.metadata;
}
Expand Down Expand Up @@ -420,14 +429,14 @@ public int hashCode() {

public boolean equals(Object o) {
if (this == o) return true;
if (this.getClass() != o.getClass()) return false;
if (o == null || this.getClass() != o.getClass()) return false;
ErrorCause other = (ErrorCause) o;
return Objects.equals(this.causedBy, other.causedBy)
&& Objects.equals(this.reason, other.reason)
&& Objects.equals(this.rootCause, other.rootCause)
&& Objects.equals(this.stackTrace, other.stackTrace)
&& Objects.equals(this.suppressed, other.suppressed)
&& Objects.equals(this.type, other.type)
&& this.type.equals(other.type)
&& Objects.equals(this.metadata, other.metadata);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.util.Objects;
import java.util.function.Function;
import javax.annotation.Generated;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
Expand All @@ -60,6 +61,7 @@ public class NodeStatistics implements PlainJsonSerializable {

private final int failed;

@Nonnull
private final List<ErrorCause> failures;

private final int successful;
Expand Down Expand Up @@ -93,6 +95,7 @@ public final int failed() {
/**
* API name: {@code failures}
*/
@Nonnull
public final List<ErrorCause> failures() {
return this.failures;
}
Expand Down Expand Up @@ -268,11 +271,11 @@ public int hashCode() {

public boolean equals(Object o) {
if (this == o) return true;
if (this.getClass() != o.getClass()) return false;
if (o == null || this.getClass() != o.getClass()) return false;
NodeStatistics other = (NodeStatistics) o;
return this.failed() == other.failed()
return this.failed == other.failed
&& Objects.equals(this.failures, other.failures)
&& this.successful() == other.successful()
&& this.total() == other.total();
&& this.successful == other.successful
&& this.total == other.total;
}
}
Loading

0 comments on commit 3c0a405

Please sign in to comment.