Skip to content

Commit

Permalink
Implementing PlainDeserializable on Request classes
Browse files Browse the repository at this point in the history
Signed-off-by: Jai2305 <[email protected]>
  • Loading branch information
Jai2305 committed Aug 25, 2024
1 parent 9793d12 commit 9f3ba2f
Show file tree
Hide file tree
Showing 76 changed files with 416 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

public interface PlainDeserializable<B> {

B get();
B self();

/** Updates object with newly provided JSON properties
@param parser the JsonParser parser
Expand All @@ -29,7 +29,7 @@ default B withJson(JsonParser parser, JsonpMapper mapper) {
@SuppressWarnings("unchecked")
ObjectDeserializer<B> objectDeserializer = (ObjectDeserializer<B>) DelegatingDeserializer.unwrap(deserializer);
assert objectDeserializer != null;
return objectDeserializer.deserialize(get(), parser, mapper, parser.next());
return objectDeserializer.deserialize(self(), parser, mapper, parser.next());
}

/** Updates object with newly provided JSON properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.ObjectBuilderDeserializer;
import org.opensearch.client.json.ObjectDeserializer;
import org.opensearch.client.json.PlainDeserializable;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.json.UnionDeserializer;
import org.opensearch.client.util.ApiTypeHelper;
Expand Down Expand Up @@ -118,7 +119,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
* Builder for {@link ErrorResponse}.
*/

public static class Builder extends ObjectBuilderBase implements ObjectBuilder<ErrorResponse> {
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<ErrorResponse>, PlainDeserializable<Builder> {
private ErrorCause error;

private Integer status;
Expand Down Expand Up @@ -157,6 +158,11 @@ public ErrorResponse build() {

return new ErrorResponse(this);
}

@Override
public Builder self() {
return this;
}
}

// ---------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.PlainDeserializable;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.opensearch.cat.aliases.AliasesRecord;
import org.opensearch.client.util.ApiTypeHelper;
Expand Down Expand Up @@ -90,7 +91,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
* Builder for {@link AliasesResponse}.
*/

public static class Builder extends ObjectBuilderBase implements ObjectBuilder<AliasesResponse> {
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<AliasesResponse>, PlainDeserializable<Builder> {
private List<AliasesRecord> valueBody;

/**
Expand Down Expand Up @@ -139,6 +140,11 @@ public AliasesResponse build() {

return new AliasesResponse(this);
}

@Override
public Builder self() {
return this;
}
}

public static final JsonpDeserializer<AliasesResponse> _DESERIALIZER = createAliasesResponseDeserializer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.PlainDeserializable;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.opensearch.cat.allocation.AllocationRecord;
import org.opensearch.client.util.ApiTypeHelper;
Expand Down Expand Up @@ -90,7 +91,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
* Builder for {@link AllocationResponse}.
*/

public static class Builder extends ObjectBuilderBase implements ObjectBuilder<AllocationResponse> {
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<AllocationResponse>, PlainDeserializable<Builder> {
private List<AllocationRecord> valueBody;

/**
Expand Down Expand Up @@ -139,6 +140,11 @@ public AllocationResponse build() {

return new AllocationResponse(this);
}

@Override
public Builder self() {
return this;
}
}

public static final JsonpDeserializer<AllocationResponse> _DESERIALIZER = createAllocationResponseDeserializer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.PlainDeserializable;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.opensearch.cat.cluster_manager.ClusterManagerRecord;
import org.opensearch.client.util.ApiTypeHelper;
Expand Down Expand Up @@ -90,7 +91,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
* Builder for {@link ClusterManagerResponse}.
*/

public static class Builder extends ObjectBuilderBase implements ObjectBuilder<ClusterManagerResponse> {
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<ClusterManagerResponse>, PlainDeserializable<Builder> {
private List<ClusterManagerRecord> valueBody;

/**
Expand Down Expand Up @@ -139,6 +140,11 @@ public ClusterManagerResponse build() {

return new ClusterManagerResponse(this);
}

@Override
public Builder self() {
return this;
}
}

public static final JsonpDeserializer<ClusterManagerResponse> _DESERIALIZER = createClusterManagerResponseDeserializer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.PlainDeserializable;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.opensearch.cat.count.CountRecord;
import org.opensearch.client.util.ApiTypeHelper;
Expand Down Expand Up @@ -90,7 +91,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
* Builder for {@link CountResponse}.
*/

public static class Builder extends ObjectBuilderBase implements ObjectBuilder<CountResponse> {
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<CountResponse>, PlainDeserializable<Builder> {
private List<CountRecord> valueBody;

/**
Expand Down Expand Up @@ -139,6 +140,11 @@ public CountResponse build() {

return new CountResponse(this);
}

@Override
public Builder self() {
return this;
}
}

public static final JsonpDeserializer<CountResponse> _DESERIALIZER = createCountResponseDeserializer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.PlainDeserializable;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.opensearch.cat.fielddata.FielddataRecord;
import org.opensearch.client.util.ApiTypeHelper;
Expand Down Expand Up @@ -90,7 +91,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
* Builder for {@link FielddataResponse}.
*/

public static class Builder extends ObjectBuilderBase implements ObjectBuilder<FielddataResponse> {
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<FielddataResponse>, PlainDeserializable<Builder> {
private List<FielddataRecord> valueBody;

/**
Expand Down Expand Up @@ -139,6 +140,11 @@ public FielddataResponse build() {

return new FielddataResponse(this);
}

@Override
public Builder self() {
return this;
}
}

public static final JsonpDeserializer<FielddataResponse> _DESERIALIZER = createFielddataResponseDeserializer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.PlainDeserializable;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.opensearch.cat.health.HealthRecord;
import org.opensearch.client.util.ApiTypeHelper;
Expand Down Expand Up @@ -90,7 +91,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
* Builder for {@link HealthResponse}.
*/

public static class Builder extends ObjectBuilderBase implements ObjectBuilder<HealthResponse> {
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<HealthResponse>, PlainDeserializable<Builder> {
private List<HealthRecord> valueBody;

/**
Expand Down Expand Up @@ -139,6 +140,11 @@ public HealthResponse build() {

return new HealthResponse(this);
}

@Override
public Builder self() {
return this;
}
}

public static final JsonpDeserializer<HealthResponse> _DESERIALIZER = createHealthResponseDeserializer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.PlainDeserializable;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.opensearch.cat.help.HelpRecord;
import org.opensearch.client.util.ApiTypeHelper;
Expand Down Expand Up @@ -90,7 +91,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
* Builder for {@link HelpResponse}.
*/

public static class Builder extends ObjectBuilderBase implements ObjectBuilder<HelpResponse> {
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<HelpResponse>, PlainDeserializable<Builder> {
private List<HelpRecord> valueBody;

/**
Expand Down Expand Up @@ -139,6 +140,11 @@ public HelpResponse build() {

return new HelpResponse(this);
}

@Override
public Builder self() {
return this;
}
}

public static final JsonpDeserializer<HelpResponse> _DESERIALIZER = createHelpResponseDeserializer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.PlainDeserializable;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.opensearch.cat.indices.IndicesRecord;
import org.opensearch.client.util.ApiTypeHelper;
Expand Down Expand Up @@ -90,7 +91,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
* Builder for {@link IndicesResponse}.
*/

public static class Builder extends ObjectBuilderBase implements ObjectBuilder<IndicesResponse> {
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<IndicesResponse>, PlainDeserializable<Builder> {
private List<IndicesRecord> valueBody;

/**
Expand Down Expand Up @@ -139,6 +140,11 @@ public IndicesResponse build() {

return new IndicesResponse(this);
}

@Override
public Builder self() {
return this;
}
}

public static final JsonpDeserializer<IndicesResponse> _DESERIALIZER = createIndicesResponseDeserializer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.PlainDeserializable;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.opensearch.cat.nodeattrs.NodeAttributesRecord;
import org.opensearch.client.util.ApiTypeHelper;
Expand Down Expand Up @@ -90,7 +91,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
* Builder for {@link NodeattrsResponse}.
*/

public static class Builder extends ObjectBuilderBase implements ObjectBuilder<NodeattrsResponse> {
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<NodeattrsResponse>, PlainDeserializable<Builder> {
private List<NodeAttributesRecord> valueBody;

/**
Expand Down Expand Up @@ -139,6 +140,11 @@ public NodeattrsResponse build() {

return new NodeattrsResponse(this);
}

@Override
public Builder self() {
return this;
}
}

public static final JsonpDeserializer<NodeattrsResponse> _DESERIALIZER = createNodeattrsResponseDeserializer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.PlainDeserializable;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.opensearch.cat.nodes.NodesRecord;
import org.opensearch.client.util.ApiTypeHelper;
Expand Down Expand Up @@ -90,7 +91,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
* Builder for {@link NodesResponse}.
*/

public static class Builder extends ObjectBuilderBase implements ObjectBuilder<NodesResponse> {
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<NodesResponse>, PlainDeserializable<Builder> {
private List<NodesRecord> valueBody;

/**
Expand Down Expand Up @@ -139,6 +140,11 @@ public NodesResponse build() {

return new NodesResponse(this);
}

@Override
public Builder self() {
return this;
}
}

public static final JsonpDeserializer<NodesResponse> _DESERIALIZER = createNodesResponseDeserializer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.PlainDeserializable;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.opensearch.cat.pending_tasks.PendingTasksRecord;
import org.opensearch.client.util.ApiTypeHelper;
Expand Down Expand Up @@ -90,7 +91,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
* Builder for {@link PendingTasksResponse}.
*/

public static class Builder extends ObjectBuilderBase implements ObjectBuilder<PendingTasksResponse> {
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<PendingTasksResponse>, PlainDeserializable<Builder> {
private List<PendingTasksRecord> valueBody;

/**
Expand Down Expand Up @@ -139,6 +140,11 @@ public PendingTasksResponse build() {

return new PendingTasksResponse(this);
}

@Override
public Builder self() {
return this;
}
}

public static final JsonpDeserializer<PendingTasksResponse> _DESERIALIZER = createPendingTasksResponseDeserializer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.PlainDeserializable;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.opensearch.cat.plugins.PluginsRecord;
import org.opensearch.client.util.ApiTypeHelper;
Expand Down Expand Up @@ -90,7 +91,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
* Builder for {@link PluginsResponse}.
*/

public static class Builder extends ObjectBuilderBase implements ObjectBuilder<PluginsResponse> {
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<PluginsResponse>, PlainDeserializable<Builder> {
private List<PluginsRecord> valueBody;

/**
Expand Down Expand Up @@ -139,6 +140,11 @@ public PluginsResponse build() {

return new PluginsResponse(this);
}

@Override
public Builder self() {
return this;
}
}

public static final JsonpDeserializer<PluginsResponse> _DESERIALIZER = createPluginsResponseDeserializer();
Expand Down
Loading

0 comments on commit 9f3ba2f

Please sign in to comment.