Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,34 @@
* GitHub history for details.
*/

//----------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------

package org.opensearch.client.opensearch._types;

import jakarta.json.stream.JsonGenerator;
import java.util.function.Function;
import javax.annotation.Generated;
import javax.annotation.Nonnull;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.ObjectBuilderDeserializer;
import org.opensearch.client.json.ObjectDeserializer;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.util.ApiTypeHelper;
import org.opensearch.client.util.CopyableBuilder;
import org.opensearch.client.util.ObjectBuilder;
import org.opensearch.client.util.ObjectBuilderBase;
import org.opensearch.client.util.ToCopyableBuilder;

// typedef: _types.ClusterStatistics

@JsonpDeserializable
public class ClusterStatistics implements PlainJsonSerializable {
@Generated("org.opensearch.client.codegen.CodeGenerator")
public class ClusterStatistics implements PlainJsonSerializable, ToCopyableBuilder<ClusterStatistics.Builder, ClusterStatistics> {

private final int skipped;

private final int successful;
Expand All @@ -57,14 +67,12 @@ public class ClusterStatistics implements PlainJsonSerializable {
// ---------------------------------------------------------------------------------------------

private ClusterStatistics(Builder builder) {

this.skipped = ApiTypeHelper.requireNonNull(builder.skipped, this, "skipped");
this.successful = ApiTypeHelper.requireNonNull(builder.successful, this, "successful");
this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total");

}

public static ClusterStatistics of(Function<Builder, ObjectBuilder<ClusterStatistics>> fn) {
public static ClusterStatistics of(Function<ClusterStatistics.Builder, ObjectBuilder<ClusterStatistics>> fn) {
return fn.apply(new Builder()).build();
}

Expand Down Expand Up @@ -92,14 +100,14 @@ public final int total() {
/**
* Serialize this object to JSON.
*/
@Override
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
generator.writeStartObject();
serializeInternal(generator, mapper);
generator.writeEnd();
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.writeKey("skipped");
generator.write(this.skipped);

Expand All @@ -108,25 +116,53 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.writeKey("total");
generator.write(this.total);

}

// ---------------------------------------------------------------------------------------------

@Override
@Nonnull
public Builder toBuilder() {
return new Builder(this);
}

@Nonnull
public static Builder builder() {
return new Builder();
}

/**
* Builder for {@link ClusterStatistics}.
*/

public static class Builder extends ObjectBuilderBase implements ObjectBuilder<ClusterStatistics> {
public static class Builder extends ObjectBuilderBase implements CopyableBuilder<Builder, ClusterStatistics> {
private Integer skipped;

private Integer successful;

private Integer total;

public Builder() {}

private Builder(ClusterStatistics o) {
this.skipped = o.skipped;
this.successful = o.successful;
this.total = o.total;
}

private Builder(Builder o) {
this.skipped = o.skipped;
this.successful = o.successful;
this.total = o.total;
}

@Override
@Nonnull
public Builder copy() {
return new Builder(this);
}

/**
* Required - API name: {@code skipped}
*/
@Nonnull
public final Builder skipped(int value) {
this.skipped = value;
return this;
Expand All @@ -135,6 +171,7 @@ public final Builder skipped(int value) {
/**
* Required - API name: {@code successful}
*/
@Nonnull
public final Builder successful(int value) {
this.successful = value;
return this;
Expand All @@ -143,6 +180,7 @@ public final Builder successful(int value) {
/**
* Required - API name: {@code total}
*/
@Nonnull
public final Builder total(int value) {
this.total = value;
return this;
Expand All @@ -151,9 +189,10 @@ public final Builder total(int value) {
/**
* Builds a {@link ClusterStatistics}.
*
* @throws NullPointerException
* if some of the required fields are null.
* @throws NullPointerException if some of the required fields are null.
*/
@Override
@Nonnull
public ClusterStatistics build() {
_checkSingleUse();

Expand All @@ -172,11 +211,25 @@ public ClusterStatistics build() {
);

protected static void setupClusterStatisticsDeserializer(ObjectDeserializer<ClusterStatistics.Builder> op) {

op.add(Builder::skipped, JsonpDeserializer.integerDeserializer(), "skipped");
op.add(Builder::successful, JsonpDeserializer.integerDeserializer(), "successful");
op.add(Builder::total, JsonpDeserializer.integerDeserializer(), "total");
}

@Override
public int hashCode() {
int result = 17;
result = 31 * result + Integer.hashCode(this.skipped);
result = 31 * result + Integer.hashCode(this.successful);
result = 31 * result + Integer.hashCode(this.total);
return result;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || this.getClass() != o.getClass()) return false;
ClusterStatistics other = (ClusterStatistics) o;
return this.skipped == other.skipped && this.successful == other.successful && this.total == other.total;
}
}
Loading
Loading