Skip to content

Commit

Permalink
Generate more mapping properties
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia committed Oct 2, 2024
1 parent 96db404 commit 597cf1a
Show file tree
Hide file tree
Showing 29 changed files with 1,552 additions and 559 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@
* GitHub history for details.
*/

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

package org.opensearch.client.opensearch._types.mapping;

import jakarta.json.stream.JsonGenerator;
import java.util.Objects;
import java.util.function.Function;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
Expand All @@ -45,25 +51,25 @@
// typedef: _types.mapping.FieldAliasProperty

@JsonpDeserializable
@Generated("org.opensearch.client.codegen.CodeGenerator")
public class FieldAliasProperty extends PropertyBase implements PropertyVariant {

@Nullable
private final String path;

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

private FieldAliasProperty(Builder builder) {
super(builder);

this.path = builder.path;

}

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

/**
* Property variant kind.
* {@link Property} variant kind.
*/
@Override
public Property.Kind _propertyKind() {
Expand All @@ -79,23 +85,19 @@ public final String path() {
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.write("type", "alias");
super.serializeInternal(generator, mapper);
if (this.path != null) {
generator.writeKey("path");
generator.write(this.path);

}

}

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

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

public static class Builder extends PropertyBase.AbstractBuilder<Builder> implements ObjectBuilder<FieldAliasProperty> {
@Nullable
private String path;
Expand All @@ -116,8 +118,7 @@ protected Builder self() {
/**
* Builds a {@link FieldAliasProperty}.
*
* @throws NullPointerException
* if some of the required fields are null.
* @throws NullPointerException if some of the required fields are null.
*/
public FieldAliasProperty build() {
_checkSingleUse();
Expand All @@ -137,10 +138,25 @@ public FieldAliasProperty build() {
);

protected static void setupFieldAliasPropertyDeserializer(ObjectDeserializer<FieldAliasProperty.Builder> op) {
PropertyBase.setupPropertyBaseDeserializer(op);
setupPropertyBaseDeserializer(op);
op.add(Builder::path, JsonpDeserializer.stringDeserializer(), "path");

op.ignore("type");
}

public int hashCode() {
int result = super.hashCode();
result = 31 * result + Objects.hashCode(this.path);
return result;
}

public boolean equals(Object o) {
if (!super.equals(o)) {
return false;
}
if (this == o) return true;
if (o == null || this.getClass() != o.getClass()) return false;
FieldAliasProperty other = (FieldAliasProperty) o;
return Objects.equals(this.path, other.path);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@
* GitHub history for details.
*/

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

package org.opensearch.client.opensearch._types.mapping;

import jakarta.json.stream.JsonGenerator;
import java.util.function.Function;
import javax.annotation.Generated;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
Expand All @@ -47,18 +52,18 @@
// typedef: _types.mapping.FieldNamesField

@JsonpDeserializable
@Generated("org.opensearch.client.codegen.CodeGenerator")
public class FieldNamesField implements PlainJsonSerializable {

private final boolean enabled;

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

private FieldNamesField(Builder builder) {

this.enabled = ApiTypeHelper.requireNonNull(builder.enabled, this, "enabled");

}

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

Expand All @@ -72,25 +77,23 @@ public final boolean enabled() {
/**
* 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("enabled");
generator.write(this.enabled);

}

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

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

public static class Builder extends ObjectBuilderBase implements ObjectBuilder<FieldNamesField> {
private Boolean enabled;

Expand All @@ -105,8 +108,7 @@ public final Builder enabled(boolean value) {
/**
* Builds a {@link FieldNamesField}.
*
* @throws NullPointerException
* if some of the required fields are null.
* @throws NullPointerException if some of the required fields are null.
*/
public FieldNamesField build() {
_checkSingleUse();
Expand All @@ -126,9 +128,19 @@ public FieldNamesField build() {
);

protected static void setupFieldNamesFieldDeserializer(ObjectDeserializer<FieldNamesField.Builder> op) {

op.add(Builder::enabled, JsonpDeserializer.booleanDeserializer(), "enabled");
}

public int hashCode() {
int result = 17;
result = 31 * result + Boolean.hashCode(this.enabled);
return result;
}

public boolean equals(Object o) {
if (this == o) return true;
if (o == null || this.getClass() != o.getClass()) return false;
FieldNamesField other = (FieldNamesField) o;
return this.enabled == other.enabled;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@
* GitHub history for details.
*/

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

package org.opensearch.client.opensearch._types.mapping;

import jakarta.json.stream.JsonGenerator;
import java.util.function.Function;
import javax.annotation.Generated;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
Expand All @@ -44,40 +49,39 @@
// typedef: _types.mapping.FloatRangeProperty

@JsonpDeserializable
@Generated("org.opensearch.client.codegen.CodeGenerator")
public class FloatRangeProperty extends RangePropertyBase implements PropertyVariant {

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

private FloatRangeProperty(Builder builder) {
super(builder);

}

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

/**
* Property variant kind.
* {@link Property} variant kind.
*/
@Override
public Property.Kind _propertyKind() {
return Property.Kind.FloatRange;
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.write("type", "float_range");
super.serializeInternal(generator, mapper);

}

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

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

public static class Builder extends RangePropertyBase.AbstractBuilder<Builder> implements ObjectBuilder<FloatRangeProperty> {

@Override
protected Builder self() {
return this;
Expand All @@ -86,8 +90,7 @@ protected Builder self() {
/**
* Builds a {@link FloatRangeProperty}.
*
* @throws NullPointerException
* if some of the required fields are null.
* @throws NullPointerException if some of the required fields are null.
*/
public FloatRangeProperty build() {
_checkSingleUse();
Expand All @@ -107,9 +110,23 @@ public FloatRangeProperty build() {
);

protected static void setupFloatRangePropertyDeserializer(ObjectDeserializer<FloatRangeProperty.Builder> op) {
RangePropertyBase.setupRangePropertyBaseDeserializer(op);
setupRangePropertyBaseDeserializer(op);

op.ignore("type");
}

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 (o == null || this.getClass() != o.getClass()) return false;
FloatRangeProperty other = (FloatRangeProperty) o;
return;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@
* GitHub history for details.
*/

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

package org.opensearch.client.opensearch._types.mapping;

import jakarta.json.stream.JsonGenerator;
import java.util.function.Function;
import javax.annotation.Generated;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
Expand All @@ -44,40 +49,39 @@
// typedef: _types.mapping.PercolatorProperty

@JsonpDeserializable
@Generated("org.opensearch.client.codegen.CodeGenerator")
public class PercolatorProperty extends PropertyBase implements PropertyVariant {

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

private PercolatorProperty(Builder builder) {
super(builder);

}

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

/**
* Property variant kind.
* {@link Property} variant kind.
*/
@Override
public Property.Kind _propertyKind() {
return Property.Kind.Percolator;
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.write("type", "percolator");
super.serializeInternal(generator, mapper);

}

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

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

public static class Builder extends PropertyBase.AbstractBuilder<Builder> implements ObjectBuilder<PercolatorProperty> {

@Override
protected Builder self() {
return this;
Expand All @@ -86,8 +90,7 @@ protected Builder self() {
/**
* Builds a {@link PercolatorProperty}.
*
* @throws NullPointerException
* if some of the required fields are null.
* @throws NullPointerException if some of the required fields are null.
*/
public PercolatorProperty build() {
_checkSingleUse();
Expand All @@ -107,9 +110,23 @@ public PercolatorProperty build() {
);

protected static void setupPercolatorPropertyDeserializer(ObjectDeserializer<PercolatorProperty.Builder> op) {
PropertyBase.setupPropertyBaseDeserializer(op);
setupPropertyBaseDeserializer(op);

op.ignore("type");
}

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 (o == null || this.getClass() != o.getClass()) return false;
PercolatorProperty other = (PercolatorProperty) o;
return;
}
}
Loading

0 comments on commit 597cf1a

Please sign in to comment.