From 017f2a13338164a0b93484d93b23dbd12e83ca3d Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Tue, 12 Nov 2024 15:53:43 +1300 Subject: [PATCH] Generate Normalizer variants Signed-off-by: Thomas Farr --- .../_types/analysis/CustomNormalizer.java | 61 ++++++--- .../_types/analysis/LowercaseNormalizer.java | 38 ++++-- .../_types/analysis/Normalizer.java | 59 +++++---- .../_types/analysis/NormalizerBuilders.java | 14 +- .../_types/analysis/NormalizerVariant.java | 8 +- .../indices/IndexSettingsAnalysis.java | 122 +++++++++++++----- .../codegen/model/overrides/Overrides.java | 6 +- 7 files changed, 205 insertions(+), 103 deletions(-) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/analysis/CustomNormalizer.java (81%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/analysis/LowercaseNormalizer.java (77%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/analysis/Normalizer.java (80%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/analysis/NormalizerBuilders.java (83%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/analysis/NormalizerVariant.java (85%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/IndexSettingsAnalysis.java (81%) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/CustomNormalizer.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/CustomNormalizer.java similarity index 81% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/CustomNormalizer.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/CustomNormalizer.java index 2cba975bef..2c5f6eb35f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/CustomNormalizer.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/CustomNormalizer.java @@ -30,18 +30,25 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.analysis; import jakarta.json.stream.JsonGenerator; import java.util.List; +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; import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.JsonpSerializable; 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.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; @@ -49,26 +56,28 @@ // typedef: _types.analysis.CustomNormalizer @JsonpDeserializable -public class CustomNormalizer implements NormalizerVariant, JsonpSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CustomNormalizer implements NormalizerVariant, PlainJsonSerializable { + + @Nonnull private final List charFilter; + @Nonnull private final List filter; // --------------------------------------------------------------------------------------------- private CustomNormalizer(Builder builder) { - this.charFilter = ApiTypeHelper.unmodifiable(builder.charFilter); this.filter = ApiTypeHelper.unmodifiable(builder.filter); - } - public static CustomNormalizer of(Function> fn) { + public static CustomNormalizer of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Normalizer variant kind. + * {@link Normalizer} variant kind. */ @Override public Normalizer.Kind _normalizerKind() { @@ -78,6 +87,7 @@ public Normalizer.Kind _normalizerKind() { /** * API name: {@code char_filter} */ + @Nonnull public final List charFilter() { return this.charFilter; } @@ -85,6 +95,7 @@ public final List charFilter() { /** * API name: {@code filter} */ + @Nonnull public final List filter() { return this.filter; } @@ -92,6 +103,7 @@ public final List filter() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -99,30 +111,24 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "custom"); - if (ApiTypeHelper.isDefined(this.charFilter)) { generator.writeKey("char_filter"); generator.writeStartArray(); for (String item0 : this.charFilter) { generator.write(item0); - } generator.writeEnd(); - } + if (ApiTypeHelper.isDefined(this.filter)) { generator.writeKey("filter"); generator.writeStartArray(); for (String item0 : this.filter) { generator.write(item0); - } generator.writeEnd(); - } - } // --------------------------------------------------------------------------------------------- @@ -130,18 +136,18 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link CustomNormalizer}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { @Nullable private List charFilter; - @Nullable private List filter; /** * API name: {@code char_filter} + * *

* Adds all elements of list to charFilter. + *

*/ public final Builder charFilter(List list) { this.charFilter = _listAddAll(this.charFilter, list); @@ -150,8 +156,10 @@ public final Builder charFilter(List list) { /** * API name: {@code char_filter} + * *

* Adds one or more values to charFilter. + *

*/ public final Builder charFilter(String value, String... values) { this.charFilter = _listAdd(this.charFilter, value, values); @@ -160,8 +168,10 @@ public final Builder charFilter(String value, String... values) { /** * API name: {@code filter} + * *

* Adds all elements of list to filter. + *

*/ public final Builder filter(List list) { this.filter = _listAddAll(this.filter, list); @@ -170,8 +180,10 @@ public final Builder filter(List list) { /** * API name: {@code filter} + * *

* Adds one or more values to filter. + *

*/ public final Builder filter(String value, String... values) { this.filter = _listAdd(this.filter, value, values); @@ -181,8 +193,7 @@ public final Builder filter(String value, String... values) { /** * Builds a {@link CustomNormalizer}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public CustomNormalizer build() { _checkSingleUse(); @@ -202,11 +213,25 @@ public CustomNormalizer build() { ); protected static void setupCustomNormalizerDeserializer(ObjectDeserializer op) { - op.add(Builder::charFilter, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "char_filter"); op.add(Builder::filter, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "filter"); op.ignore("type"); } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.charFilter); + result = 31 * result + Objects.hashCode(this.filter); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CustomNormalizer other = (CustomNormalizer) o; + return Objects.equals(this.charFilter, other.charFilter) && Objects.equals(this.filter, other.filter); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/LowercaseNormalizer.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/LowercaseNormalizer.java similarity index 77% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/LowercaseNormalizer.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/LowercaseNormalizer.java index 694214fc32..90a93ec363 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/LowercaseNormalizer.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/LowercaseNormalizer.java @@ -30,35 +30,40 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.analysis; 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; -import org.opensearch.client.json.JsonpSerializable; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; // typedef: _types.analysis.LowercaseNormalizer @JsonpDeserializable -public class LowercaseNormalizer implements NormalizerVariant, JsonpSerializable { - // --------------------------------------------------------------------------------------------- +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class LowercaseNormalizer implements NormalizerVariant, PlainJsonSerializable { - private LowercaseNormalizer(Builder builder) { + // --------------------------------------------------------------------------------------------- - } + private LowercaseNormalizer(Builder builder) {} - public static LowercaseNormalizer of(Function> fn) { + public static LowercaseNormalizer of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Normalizer variant kind. + * {@link Normalizer} variant kind. */ @Override public Normalizer.Kind _normalizerKind() { @@ -68,6 +73,7 @@ public Normalizer.Kind _normalizerKind() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -75,9 +81,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "lowercase"); - } // --------------------------------------------------------------------------------------------- @@ -85,14 +89,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link LowercaseNormalizer}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { /** * Builds a {@link LowercaseNormalizer}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public LowercaseNormalizer build() { _checkSingleUse(); @@ -116,4 +118,16 @@ protected static void setupLowercaseNormalizerDeserializer(ObjectDeserializer, JsonpSerializable { - - /** - * {@link Normalizer} variant kinds. - */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Normalizer implements TaggedUnion, PlainJsonSerializable { /** * {@link Normalizer} variant kinds. */ - public enum Kind implements JsonEnum { Custom("custom"), - - Lowercase("lowercase"), - - ; + Lowercase("lowercase"); private final String jsonValue; @@ -72,10 +71,10 @@ public enum Kind implements JsonEnum { this.jsonValue = jsonValue; } + @Override public String jsonValue() { - return this.jsonValue; + return jsonValue; } - } private final Kind _kind; @@ -92,20 +91,16 @@ public final NormalizerVariant _get() { } public Normalizer(NormalizerVariant value) { - this._kind = ApiTypeHelper.requireNonNull(value._normalizerKind(), this, ""); this._value = ApiTypeHelper.requireNonNull(value, this, ""); - } private Normalizer(Builder builder) { - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - } - public static Normalizer of(Function> fn) { + public static Normalizer of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -119,8 +114,7 @@ public boolean isCustom() { /** * Get the {@code custom} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code custom} kind. + * @throws IllegalStateException if the current variant is not the {@code custom} kind. */ public CustomNormalizer custom() { return TaggedUnionUtils.get(this, Kind.Custom); @@ -136,8 +130,7 @@ public boolean isLowercase() { /** * Get the {@code lowercase} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code lowercase} kind. + * @throws IllegalStateException if the current variant is not the {@code lowercase} kind. */ public LowercaseNormalizer lowercase() { return TaggedUnionUtils.get(this, Kind.Lowercase); @@ -145,9 +138,7 @@ public LowercaseNormalizer lowercase() { @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { - mapper.serialize(_value, generator); - } public static class Builder extends ObjectBuilderBase implements ObjectBuilder { @@ -174,20 +165,18 @@ public ObjectBuilder lowercase(Function op) { - op.add(Builder::custom, CustomNormalizer._DESERIALIZER, "custom"); op.add(Builder::lowercase, LowercaseNormalizer._DESERIALIZER, "lowercase"); op.setTypeProperty("type", Kind.Custom.jsonValue()); - } public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( @@ -195,4 +184,20 @@ protected static void setupNormalizerDeserializer(ObjectDeserializer op Normalizer::setupNormalizerDeserializer, Builder::build ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this._kind); + result = 31 * result + Objects.hashCode(this._value); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + Normalizer other = (Normalizer) o; + return Objects.equals(this._kind, other._kind) && Objects.equals(this._value, other._value); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/NormalizerBuilders.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/NormalizerBuilders.java similarity index 83% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/NormalizerBuilders.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/NormalizerBuilders.java index 34cde81982..7e0f3cecd7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/NormalizerBuilders.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/NormalizerBuilders.java @@ -30,28 +30,32 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.analysis; +import javax.annotation.Generated; + /** * Builders for {@link Normalizer} variants. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") public class NormalizerBuilders { private NormalizerBuilders() {} /** - * Creates a builder for the {@link CustomNormalizer custom} {@code Normalizer} - * variant. + * Creates a builder for the {@link CustomNormalizer custom} {@code Normalizer} variant. */ public static CustomNormalizer.Builder custom() { return new CustomNormalizer.Builder(); } /** - * Creates a builder for the {@link LowercaseNormalizer lowercase} - * {@code Normalizer} variant. + * Creates a builder for the {@link LowercaseNormalizer lowercase} {@code Normalizer} variant. */ public static LowercaseNormalizer.Builder lowercase() { return new LowercaseNormalizer.Builder(); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/NormalizerVariant.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/NormalizerVariant.java similarity index 85% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/NormalizerVariant.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/NormalizerVariant.java index a40b421918..8042942790 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/NormalizerVariant.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/NormalizerVariant.java @@ -30,19 +30,23 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.analysis; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpSerializable; /** * Base interface for {@link Normalizer} variants. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") public interface NormalizerVariant extends JsonpSerializable { - Normalizer.Kind _normalizerKind(); default Normalizer _toNormalizer() { return new Normalizer(this); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/IndexSettingsAnalysis.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/IndexSettingsAnalysis.java similarity index 81% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/IndexSettingsAnalysis.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/IndexSettingsAnalysis.java index 834cdd47ca..ccf3bb3683 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/IndexSettingsAnalysis.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/IndexSettingsAnalysis.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.Map; +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; @@ -51,39 +58,45 @@ import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -// typedef: indices._types.IndexSettingsAnalysis +// typedef: indices.IndexSettingsAnalysis @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class IndexSettingsAnalysis implements PlainJsonSerializable { + + @Nonnull private final Map analyzer; + @Nonnull private final Map charFilter; + @Nonnull private final Map filter; + @Nonnull private final Map normalizer; + @Nonnull private final Map tokenizer; // --------------------------------------------------------------------------------------------- private IndexSettingsAnalysis(Builder builder) { - this.analyzer = ApiTypeHelper.unmodifiable(builder.analyzer); this.charFilter = ApiTypeHelper.unmodifiable(builder.charFilter); this.filter = ApiTypeHelper.unmodifiable(builder.filter); this.normalizer = ApiTypeHelper.unmodifiable(builder.normalizer); this.tokenizer = ApiTypeHelper.unmodifiable(builder.tokenizer); - } - public static IndexSettingsAnalysis of(Function> fn) { + public static IndexSettingsAnalysis of(Function> fn) { return fn.apply(new Builder()).build(); } /** * API name: {@code analyzer} */ + @Nonnull public final Map analyzer() { return this.analyzer; } @@ -91,6 +104,7 @@ public final Map analyzer() { /** * API name: {@code char_filter} */ + @Nonnull public final Map charFilter() { return this.charFilter; } @@ -98,6 +112,7 @@ public final Map charFilter() { /** * API name: {@code filter} */ + @Nonnull public final Map filter() { return this.filter; } @@ -105,6 +120,7 @@ public final Map filter() { /** * API name: {@code normalizer} */ + @Nonnull public final Map normalizer() { return this.normalizer; } @@ -112,6 +128,7 @@ public final Map normalizer() { /** * API name: {@code tokenizer} */ + @Nonnull public final Map tokenizer() { return this.tokenizer; } @@ -119,6 +136,7 @@ public final Map tokenizer() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -126,63 +144,55 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (ApiTypeHelper.isDefined(this.analyzer)) { generator.writeKey("analyzer"); generator.writeStartObject(); for (Map.Entry item0 : this.analyzer.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + if (ApiTypeHelper.isDefined(this.charFilter)) { generator.writeKey("char_filter"); generator.writeStartObject(); for (Map.Entry item0 : this.charFilter.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + if (ApiTypeHelper.isDefined(this.filter)) { generator.writeKey("filter"); generator.writeStartObject(); for (Map.Entry item0 : this.filter.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + if (ApiTypeHelper.isDefined(this.normalizer)) { generator.writeKey("normalizer"); generator.writeStartObject(); for (Map.Entry item0 : this.normalizer.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + if (ApiTypeHelper.isDefined(this.tokenizer)) { generator.writeKey("tokenizer"); generator.writeStartObject(); for (Map.Entry item0 : this.tokenizer.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } - } // --------------------------------------------------------------------------------------------- @@ -190,27 +200,24 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link IndexSettingsAnalysis}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { @Nullable private Map analyzer; - @Nullable private Map charFilter; - @Nullable private Map filter; - @Nullable private Map normalizer; - @Nullable private Map tokenizer; /** * API name: {@code analyzer} + * *

- * Adds all entries of map to analyzer. + * Adds all elements of map to analyzer. + *

*/ public final Builder analyzer(Map map) { this.analyzer = _mapPutAll(this.analyzer, map); @@ -219,8 +226,10 @@ public final Builder analyzer(Map map) { /** * API name: {@code analyzer} + * *

* Adds an entry to analyzer. + *

*/ public final Builder analyzer(String key, Analyzer value) { this.analyzer = _mapPut(this.analyzer, key, value); @@ -229,8 +238,10 @@ public final Builder analyzer(String key, Analyzer value) { /** * API name: {@code analyzer} + * *

- * Adds an entry to analyzer using a builder lambda. + * Adds a value to analyzer using a builder lambda. + *

*/ public final Builder analyzer(String key, Function> fn) { return analyzer(key, fn.apply(new Analyzer.Builder()).build()); @@ -238,8 +249,10 @@ public final Builder analyzer(String key, Function - * Adds all entries of map to charFilter. + * Adds all elements of map to charFilter. + *

*/ public final Builder charFilter(Map map) { this.charFilter = _mapPutAll(this.charFilter, map); @@ -248,8 +261,10 @@ public final Builder charFilter(Map map) { /** * API name: {@code char_filter} + * *

* Adds an entry to charFilter. + *

*/ public final Builder charFilter(String key, CharFilter value) { this.charFilter = _mapPut(this.charFilter, key, value); @@ -258,8 +273,10 @@ public final Builder charFilter(String key, CharFilter value) { /** * API name: {@code char_filter} + * *

- * Adds an entry to charFilter using a builder lambda. + * Adds a value to charFilter using a builder lambda. + *

*/ public final Builder charFilter(String key, Function> fn) { return charFilter(key, fn.apply(new CharFilter.Builder()).build()); @@ -267,8 +284,10 @@ public final Builder charFilter(String key, Function - * Adds all entries of map to filter. + * Adds all elements of map to filter. + *

*/ public final Builder filter(Map map) { this.filter = _mapPutAll(this.filter, map); @@ -277,8 +296,10 @@ public final Builder filter(Map map) { /** * API name: {@code filter} + * *

* Adds an entry to filter. + *

*/ public final Builder filter(String key, TokenFilter value) { this.filter = _mapPut(this.filter, key, value); @@ -287,8 +308,10 @@ public final Builder filter(String key, TokenFilter value) { /** * API name: {@code filter} + * *

- * Adds an entry to filter using a builder lambda. + * Adds a value to filter using a builder lambda. + *

*/ public final Builder filter(String key, Function> fn) { return filter(key, fn.apply(new TokenFilter.Builder()).build()); @@ -296,8 +319,10 @@ public final Builder filter(String key, Function - * Adds all entries of map to normalizer. + * Adds all elements of map to normalizer. + *

*/ public final Builder normalizer(Map map) { this.normalizer = _mapPutAll(this.normalizer, map); @@ -306,8 +331,10 @@ public final Builder normalizer(Map map) { /** * API name: {@code normalizer} + * *

* Adds an entry to normalizer. + *

*/ public final Builder normalizer(String key, Normalizer value) { this.normalizer = _mapPut(this.normalizer, key, value); @@ -316,8 +343,10 @@ public final Builder normalizer(String key, Normalizer value) { /** * API name: {@code normalizer} + * *

- * Adds an entry to normalizer using a builder lambda. + * Adds a value to normalizer using a builder lambda. + *

*/ public final Builder normalizer(String key, Function> fn) { return normalizer(key, fn.apply(new Normalizer.Builder()).build()); @@ -325,8 +354,10 @@ public final Builder normalizer(String key, Function - * Adds all entries of map to tokenizer. + * Adds all elements of map to tokenizer. + *

*/ public final Builder tokenizer(Map map) { this.tokenizer = _mapPutAll(this.tokenizer, map); @@ -335,8 +366,10 @@ public final Builder tokenizer(Map map) { /** * API name: {@code tokenizer} + * *

* Adds an entry to tokenizer. + *

*/ public final Builder tokenizer(String key, Tokenizer value) { this.tokenizer = _mapPut(this.tokenizer, key, value); @@ -345,8 +378,10 @@ public final Builder tokenizer(String key, Tokenizer value) { /** * API name: {@code tokenizer} + * *

- * Adds an entry to tokenizer using a builder lambda. + * Adds a value to tokenizer using a builder lambda. + *

*/ public final Builder tokenizer(String key, Function> fn) { return tokenizer(key, fn.apply(new Tokenizer.Builder()).build()); @@ -355,8 +390,7 @@ public final Builder tokenizer(String key, Function op) { - op.add(Builder::analyzer, JsonpDeserializer.stringMapDeserializer(Analyzer._DESERIALIZER), "analyzer"); op.add(Builder::charFilter, JsonpDeserializer.stringMapDeserializer(CharFilter._DESERIALIZER), "char_filter"); op.add(Builder::filter, JsonpDeserializer.stringMapDeserializer(TokenFilter._DESERIALIZER), "filter"); op.add(Builder::normalizer, JsonpDeserializer.stringMapDeserializer(Normalizer._DESERIALIZER), "normalizer"); op.add(Builder::tokenizer, JsonpDeserializer.stringMapDeserializer(Tokenizer._DESERIALIZER), "tokenizer"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.analyzer); + result = 31 * result + Objects.hashCode(this.charFilter); + result = 31 * result + Objects.hashCode(this.filter); + result = 31 * result + Objects.hashCode(this.normalizer); + result = 31 * result + Objects.hashCode(this.tokenizer); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + IndexSettingsAnalysis other = (IndexSettingsAnalysis) o; + return Objects.equals(this.analyzer, other.analyzer) + && Objects.equals(this.charFilter, other.charFilter) + && Objects.equals(this.filter, other.filter) + && Objects.equals(this.normalizer, other.normalizer) + && Objects.equals(this.tokenizer, other.tokenizer); + } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java index 464fad0519..f47eab9331 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java @@ -32,11 +32,6 @@ private static JsonPointer schema(String namespace, String name) { .with(schema("_common", "Stringifiedboolean"), so -> so.withMappedType(Types.Primitive.Boolean)) .with(schema("_common", "StringifiedEpochTimeUnitMillis"), so -> so.withMappedType(Types.Primitive.Long)) - .with(schema("_common.analysis", "Analyzer"), so -> so.withShouldGenerate(ShouldGenerate.Always)) - .with(schema("_common.analysis", "CharFilter"), so -> so.withShouldGenerate(ShouldGenerate.Always)) - .with(schema("_common.analysis", "TokenFilter"), so -> so.withShouldGenerate(ShouldGenerate.Always)) - .with(schema("_common.analysis", "Tokenizer"), so -> so.withShouldGenerate(ShouldGenerate.Always)) - // TODO: Remove this to generate property mapping types .with(schema("_common.mapping", "Property"), so -> so.withShouldGenerate(ShouldGenerate.Never)) .with(schema("_common.mapping", "PropertyBase"), so -> so.withShouldGenerate(ShouldGenerate.Never)) @@ -50,6 +45,7 @@ private static JsonPointer schema(String namespace, String name) { // TODO: Remove this to generate index settings types .with(schema("indices._common", "IndexSettings"), so -> so.withShouldGenerate(ShouldGenerate.Never)) + .with(schema("indices._common", "IndexSettingsAnalysis"), so -> so.withShouldGenerate(ShouldGenerate.Always)) ).build(); @Nonnull