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 597cf1a commit bbfabad
Show file tree
Hide file tree
Showing 9 changed files with 207 additions and 259 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.ByteNumberProperty

@JsonpDeserializable
public class ByteNumberProperty extends StandardNumberProperty implements PropertyVariant {
@Generated("org.opensearch.client.codegen.CodeGenerator")
public class ByteNumberProperty extends NumberPropertyBase implements PropertyVariant {

@Nullable
private final Number nullValue;

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

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

this.nullValue = builder.nullValue;

}

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

/**
* Property variant kind.
* {@link Property} variant kind.
*/
@Override
public Property.Kind _propertyKind() {
Expand All @@ -79,24 +85,20 @@ public final Number nullValue() {
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.write("type", "byte");
super.serializeInternal(generator, mapper);
if (this.nullValue != null) {
generator.writeKey("null_value");
generator.write(this.nullValue.doubleValue());

}

}

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

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

public static class Builder extends StandardNumberProperty.AbstractBuilder<Builder> implements ObjectBuilder<ByteNumberProperty> {
public static class Builder extends NumberPropertyBase.AbstractBuilder<Builder> implements ObjectBuilder<ByteNumberProperty> {
@Nullable
private Number nullValue;

Expand All @@ -116,8 +118,7 @@ protected Builder self() {
/**
* Builds a {@link ByteNumberProperty}.
*
* @throws NullPointerException
* if some of the required fields are null.
* @throws NullPointerException if some of the required fields are null.
*/
public ByteNumberProperty build() {
_checkSingleUse();
Expand All @@ -137,10 +138,25 @@ public ByteNumberProperty build() {
);

protected static void setupByteNumberPropertyDeserializer(ObjectDeserializer<ByteNumberProperty.Builder> op) {
setupStandardNumberPropertyDeserializer(op);
setupNumberPropertyBaseDeserializer(op);
op.add(Builder::nullValue, JsonpDeserializer.numberDeserializer(), "null_value");

op.ignore("type");
}

public int hashCode() {
int result = super.hashCode();
result = 31 * result + Objects.hashCode(this.nullValue);
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;
ByteNumberProperty other = (ByteNumberProperty) o;
return Objects.equals(this.nullValue, other.nullValue);
}
}
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.DoubleNumberProperty

@JsonpDeserializable
public class DoubleNumberProperty extends StandardNumberProperty implements PropertyVariant {
@Generated("org.opensearch.client.codegen.CodeGenerator")
public class DoubleNumberProperty extends NumberPropertyBase implements PropertyVariant {

@Nullable
private final Double nullValue;

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

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

this.nullValue = builder.nullValue;

}

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

/**
* Property variant kind.
* {@link Property} variant kind.
*/
@Override
public Property.Kind _propertyKind() {
Expand All @@ -79,24 +85,20 @@ public final Double nullValue() {
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.write("type", "double");
super.serializeInternal(generator, mapper);
if (this.nullValue != null) {
generator.writeKey("null_value");
generator.write(this.nullValue);

}

}

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

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

public static class Builder extends StandardNumberProperty.AbstractBuilder<Builder> implements ObjectBuilder<DoubleNumberProperty> {
public static class Builder extends NumberPropertyBase.AbstractBuilder<Builder> implements ObjectBuilder<DoubleNumberProperty> {
@Nullable
private Double nullValue;

Expand All @@ -116,8 +118,7 @@ protected Builder self() {
/**
* Builds a {@link DoubleNumberProperty}.
*
* @throws NullPointerException
* if some of the required fields are null.
* @throws NullPointerException if some of the required fields are null.
*/
public DoubleNumberProperty build() {
_checkSingleUse();
Expand All @@ -137,10 +138,25 @@ public DoubleNumberProperty build() {
);

protected static void setupDoubleNumberPropertyDeserializer(ObjectDeserializer<DoubleNumberProperty.Builder> op) {
StandardNumberProperty.setupStandardNumberPropertyDeserializer(op);
setupNumberPropertyBaseDeserializer(op);
op.add(Builder::nullValue, JsonpDeserializer.doubleDeserializer(), "null_value");

op.ignore("type");
}

public int hashCode() {
int result = super.hashCode();
result = 31 * result + Objects.hashCode(this.nullValue);
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;
DoubleNumberProperty other = (DoubleNumberProperty) o;
return Objects.equals(this.nullValue, other.nullValue);
}
}
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.FloatNumberProperty

@JsonpDeserializable
public class FloatNumberProperty extends StandardNumberProperty implements PropertyVariant {
@Generated("org.opensearch.client.codegen.CodeGenerator")
public class FloatNumberProperty extends NumberPropertyBase implements PropertyVariant {

@Nullable
private final Float nullValue;

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

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

this.nullValue = builder.nullValue;

}

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

/**
* Property variant kind.
* {@link Property} variant kind.
*/
@Override
public Property.Kind _propertyKind() {
Expand All @@ -79,24 +85,20 @@ public final Float nullValue() {
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.write("type", "float");
super.serializeInternal(generator, mapper);
if (this.nullValue != null) {
generator.writeKey("null_value");
generator.write(this.nullValue);

}

}

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

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

public static class Builder extends StandardNumberProperty.AbstractBuilder<Builder> implements ObjectBuilder<FloatNumberProperty> {
public static class Builder extends NumberPropertyBase.AbstractBuilder<Builder> implements ObjectBuilder<FloatNumberProperty> {
@Nullable
private Float nullValue;

Expand All @@ -116,8 +118,7 @@ protected Builder self() {
/**
* Builds a {@link FloatNumberProperty}.
*
* @throws NullPointerException
* if some of the required fields are null.
* @throws NullPointerException if some of the required fields are null.
*/
public FloatNumberProperty build() {
_checkSingleUse();
Expand All @@ -137,10 +138,25 @@ public FloatNumberProperty build() {
);

protected static void setupFloatNumberPropertyDeserializer(ObjectDeserializer<FloatNumberProperty.Builder> op) {
StandardNumberProperty.setupStandardNumberPropertyDeserializer(op);
setupNumberPropertyBaseDeserializer(op);
op.add(Builder::nullValue, JsonpDeserializer.floatDeserializer(), "null_value");

op.ignore("type");
}

public int hashCode() {
int result = super.hashCode();
result = 31 * result + Objects.hashCode(this.nullValue);
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;
FloatNumberProperty other = (FloatNumberProperty) o;
return Objects.equals(this.nullValue, other.nullValue);
}
}
Loading

0 comments on commit bbfabad

Please sign in to comment.