diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/Analyzer.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/Analyzer.java similarity index 84% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/Analyzer.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/Analyzer.java index 0a0ffd6f4e..bdb320055d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/Analyzer.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/Analyzer.java @@ -30,17 +30,23 @@ * 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.Objects; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; 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; @@ -50,49 +56,28 @@ // typedef: _types.analysis.Analyzer @JsonpDeserializable -public class Analyzer implements TaggedUnion, JsonpSerializable { - - /** - * {@link Analyzer} variant kinds. - */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Analyzer implements TaggedUnion, PlainJsonSerializable { /** * {@link Analyzer} variant kinds. */ - public enum Kind implements JsonEnum { + Cjk("cjk"), Custom("custom"), - Dutch("dutch"), - Fingerprint("fingerprint"), - IcuAnalyzer("icu_analyzer"), - Keyword("keyword"), - Kuromoji("kuromoji"), - Language("language"), - Nori("nori"), - Pattern("pattern"), - Simple("simple"), - + Smartcn("smartcn"), Snowball("snowball"), - Standard("standard"), - Stop("stop"), - - Whitespace("whitespace"), - - Smartcn("smartcn"), - - Cjk("cjk"), - - ; + Whitespace("whitespace"); private final String jsonValue; @@ -100,10 +85,10 @@ public enum Kind implements JsonEnum { this.jsonValue = jsonValue; } + @Override public String jsonValue() { - return this.jsonValue; + return jsonValue; } - } private final Kind _kind; @@ -120,23 +105,35 @@ public final AnalyzerVariant _get() { } public Analyzer(AnalyzerVariant value) { - this._kind = ApiTypeHelper.requireNonNull(value._analyzerKind(), this, ""); this._value = ApiTypeHelper.requireNonNull(value, this, ""); - } private Analyzer(Builder builder) { - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - } - public static Analyzer of(Function> fn) { + public static Analyzer of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * Is this variant instance of kind {@code cjk}? + */ + public boolean isCjk() { + return _kind == Kind.Cjk; + } + + /** + * Get the {@code cjk} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code cjk} kind. + */ + public CjkAnalyzer cjk() { + return TaggedUnionUtils.get(this, Kind.Cjk); + } + /** * Is this variant instance of kind {@code custom}? */ @@ -147,8 +144,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 CustomAnalyzer custom() { return TaggedUnionUtils.get(this, Kind.Custom); @@ -164,8 +160,7 @@ public boolean isDutch() { /** * Get the {@code dutch} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code dutch} kind. + * @throws IllegalStateException if the current variant is not the {@code dutch} kind. */ public DutchAnalyzer dutch() { return TaggedUnionUtils.get(this, Kind.Dutch); @@ -181,8 +176,7 @@ public boolean isFingerprint() { /** * Get the {@code fingerprint} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code fingerprint} kind. + * @throws IllegalStateException if the current variant is not the {@code fingerprint} kind. */ public FingerprintAnalyzer fingerprint() { return TaggedUnionUtils.get(this, Kind.Fingerprint); @@ -198,8 +192,7 @@ public boolean isIcuAnalyzer() { /** * Get the {@code icu_analyzer} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code icu_analyzer} kind. + * @throws IllegalStateException if the current variant is not the {@code icu_analyzer} kind. */ public IcuAnalyzer icuAnalyzer() { return TaggedUnionUtils.get(this, Kind.IcuAnalyzer); @@ -215,8 +208,7 @@ public boolean isKeyword() { /** * Get the {@code keyword} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code keyword} kind. + * @throws IllegalStateException if the current variant is not the {@code keyword} kind. */ public KeywordAnalyzer keyword() { return TaggedUnionUtils.get(this, Kind.Keyword); @@ -232,8 +224,7 @@ public boolean isKuromoji() { /** * Get the {@code kuromoji} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code kuromoji} kind. + * @throws IllegalStateException if the current variant is not the {@code kuromoji} kind. */ public KuromojiAnalyzer kuromoji() { return TaggedUnionUtils.get(this, Kind.Kuromoji); @@ -249,8 +240,7 @@ public boolean isLanguage() { /** * Get the {@code language} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code language} kind. + * @throws IllegalStateException if the current variant is not the {@code language} kind. */ public LanguageAnalyzer language() { return TaggedUnionUtils.get(this, Kind.Language); @@ -266,8 +256,7 @@ public boolean isNori() { /** * Get the {@code nori} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code nori} kind. + * @throws IllegalStateException if the current variant is not the {@code nori} kind. */ public NoriAnalyzer nori() { return TaggedUnionUtils.get(this, Kind.Nori); @@ -283,8 +272,7 @@ public boolean isPattern() { /** * Get the {@code pattern} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code pattern} kind. + * @throws IllegalStateException if the current variant is not the {@code pattern} kind. */ public PatternAnalyzer pattern() { return TaggedUnionUtils.get(this, Kind.Pattern); @@ -300,13 +288,28 @@ public boolean isSimple() { /** * Get the {@code simple} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code simple} kind. + * @throws IllegalStateException if the current variant is not the {@code simple} kind. */ public SimpleAnalyzer simple() { return TaggedUnionUtils.get(this, Kind.Simple); } + /** + * Is this variant instance of kind {@code smartcn}? + */ + public boolean isSmartcn() { + return _kind == Kind.Smartcn; + } + + /** + * Get the {@code smartcn} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code smartcn} kind. + */ + public SmartcnAnalyzer smartcn() { + return TaggedUnionUtils.get(this, Kind.Smartcn); + } + /** * Is this variant instance of kind {@code snowball}? */ @@ -317,8 +320,7 @@ public boolean isSnowball() { /** * Get the {@code snowball} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code snowball} kind. + * @throws IllegalStateException if the current variant is not the {@code snowball} kind. */ public SnowballAnalyzer snowball() { return TaggedUnionUtils.get(this, Kind.Snowball); @@ -334,8 +336,7 @@ public boolean isStandard() { /** * Get the {@code standard} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code standard} kind. + * @throws IllegalStateException if the current variant is not the {@code standard} kind. */ public StandardAnalyzer standard() { return TaggedUnionUtils.get(this, Kind.Standard); @@ -351,8 +352,7 @@ public boolean isStop() { /** * Get the {@code stop} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code stop} kind. + * @throws IllegalStateException if the current variant is not the {@code stop} kind. */ public StopAnalyzer stop() { return TaggedUnionUtils.get(this, Kind.Stop); @@ -368,58 +368,31 @@ public boolean isWhitespace() { /** * Get the {@code whitespace} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code whitespace} kind. + * @throws IllegalStateException if the current variant is not the {@code whitespace} kind. */ public WhitespaceAnalyzer whitespace() { return TaggedUnionUtils.get(this, Kind.Whitespace); } - /** - * Is this variant instance of kind {@code cjk}? - */ - public boolean isSmartcn() { - return _kind == Kind.Smartcn; - } - - /** - * Get the {@code cjk} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code cjk} kind. - */ - public SmartcnAnalyzer smartcn() { - return TaggedUnionUtils.get(this, Kind.Smartcn); - } - - /** - * Is this variant instance of kind {@code cjk}? - */ - public boolean isCjk() { - return _kind == Kind.Cjk; - } - - /** - * Get the {@code cjk} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code cjk} kind. - */ - public CjkAnalyzer cjk() { - return TaggedUnionUtils.get(this, Kind.Cjk); - } - @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { - mapper.serialize(_value, generator); - } public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Kind _kind; private AnalyzerVariant _value; + public ObjectBuilder cjk(CjkAnalyzer v) { + this._kind = Kind.Cjk; + this._value = v; + return this; + } + + public ObjectBuilder cjk(Function> fn) { + return this.cjk(fn.apply(new CjkAnalyzer.Builder()).build()); + } + public ObjectBuilder custom(CustomAnalyzer v) { this._kind = Kind.Custom; this._value = v; @@ -520,6 +493,16 @@ public ObjectBuilder simple(Function smartcn(SmartcnAnalyzer v) { + this._kind = Kind.Smartcn; + this._value = v; + return this; + } + + public ObjectBuilder smartcn(Function> fn) { + return this.smartcn(fn.apply(new SmartcnAnalyzer.Builder()).build()); + } + public ObjectBuilder snowball(SnowballAnalyzer v) { this._kind = Kind.Snowball; this._value = v; @@ -560,35 +543,15 @@ public ObjectBuilder whitespace(Function smartcn(SmartcnAnalyzer v) { - this._kind = Kind.Smartcn; - this._value = v; - return this; - } - - public ObjectBuilder smartcn() { - return this.smartcn(new SmartcnAnalyzer.Builder().build()); - } - - public ObjectBuilder cjk(CjkAnalyzer v) { - this._kind = Kind.Cjk; - this._value = v; - return this; - } - - public ObjectBuilder cjk(Function> fn) { - return this.cjk(fn.apply(new CjkAnalyzer.Builder()).build()); - } - + @Override public Analyzer build() { _checkSingleUse(); return new Analyzer(this); } - } protected static void setupAnalyzerDeserializer(ObjectDeserializer op) { - + op.add(Builder::cjk, CjkAnalyzer._DESERIALIZER, "cjk"); op.add(Builder::custom, CustomAnalyzer._DESERIALIZER, "custom"); op.add(Builder::dutch, DutchAnalyzer._DESERIALIZER, "dutch"); op.add(Builder::fingerprint, FingerprintAnalyzer._DESERIALIZER, "fingerprint"); @@ -599,15 +562,13 @@ protected static void setupAnalyzerDeserializer(ObjectDeserializer op) op.add(Builder::nori, NoriAnalyzer._DESERIALIZER, "nori"); op.add(Builder::pattern, PatternAnalyzer._DESERIALIZER, "pattern"); op.add(Builder::simple, SimpleAnalyzer._DESERIALIZER, "simple"); + op.add(Builder::smartcn, SmartcnAnalyzer._DESERIALIZER, "smartcn"); op.add(Builder::snowball, SnowballAnalyzer._DESERIALIZER, "snowball"); op.add(Builder::standard, StandardAnalyzer._DESERIALIZER, "standard"); op.add(Builder::stop, StopAnalyzer._DESERIALIZER, "stop"); op.add(Builder::whitespace, WhitespaceAnalyzer._DESERIALIZER, "whitespace"); - op.add(Builder::smartcn, SmartcnAnalyzer._DESERIALIZER, Kind.Smartcn.jsonValue()); - op.add(Builder::cjk, CjkAnalyzer._DESERIALIZER, Kind.Cjk.jsonValue()); op.setTypeProperty("type", Kind.Custom.jsonValue()); - } public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( @@ -615,4 +576,20 @@ protected static void setupAnalyzerDeserializer(ObjectDeserializer op) Analyzer::setupAnalyzerDeserializer, 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; + Analyzer other = (Analyzer) 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/AnalyzerBuilders.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/AnalyzerBuilders.java similarity index 79% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/AnalyzerBuilders.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/AnalyzerBuilders.java index a721a52b9c..f5640e1df2 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/AnalyzerBuilders.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/AnalyzerBuilders.java @@ -30,65 +30,72 @@ * 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 Analyzer} variants. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") public class AnalyzerBuilders { private AnalyzerBuilders() {} /** - * Creates a builder for the {@link CustomAnalyzer custom} {@code Analyzer} - * variant. + * Creates a builder for the {@link CjkAnalyzer cjk} {@code Analyzer} variant. + */ + public static CjkAnalyzer.Builder cjk() { + return new CjkAnalyzer.Builder(); + } + + /** + * Creates a builder for the {@link CustomAnalyzer custom} {@code Analyzer} variant. */ public static CustomAnalyzer.Builder custom() { return new CustomAnalyzer.Builder(); } /** - * Creates a builder for the {@link DutchAnalyzer dutch} {@code Analyzer} - * variant. + * Creates a builder for the {@link DutchAnalyzer dutch} {@code Analyzer} variant. */ public static DutchAnalyzer.Builder dutch() { return new DutchAnalyzer.Builder(); } /** - * Creates a builder for the {@link FingerprintAnalyzer fingerprint} - * {@code Analyzer} variant. + * Creates a builder for the {@link FingerprintAnalyzer fingerprint} {@code Analyzer} variant. */ public static FingerprintAnalyzer.Builder fingerprint() { return new FingerprintAnalyzer.Builder(); } /** - * Creates a builder for the {@link IcuAnalyzer icu_analyzer} {@code Analyzer} - * variant. + * Creates a builder for the {@link IcuAnalyzer icu_analyzer} {@code Analyzer} variant. */ public static IcuAnalyzer.Builder icuAnalyzer() { return new IcuAnalyzer.Builder(); } /** - * Creates a builder for the {@link KeywordAnalyzer keyword} {@code Analyzer} - * variant. + * Creates a builder for the {@link KeywordAnalyzer keyword} {@code Analyzer} variant. */ public static KeywordAnalyzer.Builder keyword() { return new KeywordAnalyzer.Builder(); } /** - * Creates a builder for the {@link KuromojiAnalyzer kuromoji} {@code Analyzer} - * variant. + * Creates a builder for the {@link KuromojiAnalyzer kuromoji} {@code Analyzer} variant. */ public static KuromojiAnalyzer.Builder kuromoji() { return new KuromojiAnalyzer.Builder(); } /** - * Creates a builder for the {@link LanguageAnalyzer language} {@code Analyzer} - * variant. + * Creates a builder for the {@link LanguageAnalyzer language} {@code Analyzer} variant. */ public static LanguageAnalyzer.Builder language() { return new LanguageAnalyzer.Builder(); @@ -102,32 +109,35 @@ public static NoriAnalyzer.Builder nori() { } /** - * Creates a builder for the {@link PatternAnalyzer pattern} {@code Analyzer} - * variant. + * Creates a builder for the {@link PatternAnalyzer pattern} {@code Analyzer} variant. */ public static PatternAnalyzer.Builder pattern() { return new PatternAnalyzer.Builder(); } /** - * Creates a builder for the {@link SimpleAnalyzer simple} {@code Analyzer} - * variant. + * Creates a builder for the {@link SimpleAnalyzer simple} {@code Analyzer} variant. */ public static SimpleAnalyzer.Builder simple() { return new SimpleAnalyzer.Builder(); } /** - * Creates a builder for the {@link SnowballAnalyzer snowball} {@code Analyzer} - * variant. + * Creates a builder for the {@link SmartcnAnalyzer smartcn} {@code Analyzer} variant. + */ + public static SmartcnAnalyzer.Builder smartcn() { + return new SmartcnAnalyzer.Builder(); + } + + /** + * Creates a builder for the {@link SnowballAnalyzer snowball} {@code Analyzer} variant. */ public static SnowballAnalyzer.Builder snowball() { return new SnowballAnalyzer.Builder(); } /** - * Creates a builder for the {@link StandardAnalyzer standard} {@code Analyzer} - * variant. + * Creates a builder for the {@link StandardAnalyzer standard} {@code Analyzer} variant. */ public static StandardAnalyzer.Builder standard() { return new StandardAnalyzer.Builder(); @@ -141,11 +151,9 @@ public static StopAnalyzer.Builder stop() { } /** - * Creates a builder for the {@link WhitespaceAnalyzer whitespace} - * {@code Analyzer} variant. + * Creates a builder for the {@link WhitespaceAnalyzer whitespace} {@code Analyzer} variant. */ public static WhitespaceAnalyzer.Builder whitespace() { return new WhitespaceAnalyzer.Builder(); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/AnalyzerVariant.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/AnalyzerVariant.java similarity index 84% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/AnalyzerVariant.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/AnalyzerVariant.java index 9ce68c2c19..e41fd10fde 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/AnalyzerVariant.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/AnalyzerVariant.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 Analyzer} variants. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") public interface AnalyzerVariant extends JsonpSerializable { - Analyzer.Kind _analyzerKind(); default Analyzer _toAnalyzer() { return new Analyzer(this); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/CjkAnalyzer.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/CjkAnalyzer.java similarity index 74% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/CjkAnalyzer.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/CjkAnalyzer.java index 90ba5bf0b9..2f14edda25 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/CjkAnalyzer.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/CjkAnalyzer.java @@ -6,27 +6,36 @@ * compatible open source license. */ +//---------------------------------------------------- +// 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; -// typedef: _types.analysis.LanguageAnalyzer +// typedef: _types.analysis.CjkAnalyzer @JsonpDeserializable -public class CjkAnalyzer implements AnalyzerVariant, JsonpSerializable { - @Nullable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CjkAnalyzer implements AnalyzerVariant, PlainJsonSerializable { + + @Nonnull private final List stopwords; @Nullable @@ -35,18 +44,16 @@ public class CjkAnalyzer implements AnalyzerVariant, JsonpSerializable { // --------------------------------------------------------------------------------------------- private CjkAnalyzer(Builder builder) { - this.stopwords = ApiTypeHelper.unmodifiable(builder.stopwords); this.stopwordsPath = builder.stopwordsPath; - } - public static CjkAnalyzer of(Function> fn) { + public static CjkAnalyzer of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Analyzer variant kind. + * {@link Analyzer} variant kind. */ @Override public Analyzer.Kind _analyzerKind() { @@ -56,6 +63,7 @@ public Analyzer.Kind _analyzerKind() { /** * API name: {@code stopwords} */ + @Nonnull public final List stopwords() { return this.stopwords; } @@ -71,6 +79,7 @@ public final String stopwordsPath() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -78,25 +87,20 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.write("type", Analyzer.Kind.Cjk.jsonValue()); - + generator.write("type", "cjk"); if (ApiTypeHelper.isDefined(this.stopwords)) { generator.writeKey("stopwords"); generator.writeStartArray(); for (String item0 : this.stopwords) { generator.write(item0); - } generator.writeEnd(); - } + if (this.stopwordsPath != null) { generator.writeKey("stopwords_path"); generator.write(this.stopwordsPath); - } - } // --------------------------------------------------------------------------------------------- @@ -104,18 +108,18 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link CjkAnalyzer}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { @Nullable private List stopwords; - @Nullable private String stopwordsPath; /** * API name: {@code stopwords} + * *

* Adds all elements of list to stopwords. + *

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

* Adds one or more values to stopwords. + *

*/ public final Builder stopwords(String value, String... values) { this.stopwords = _listAdd(this.stopwords, value, values); @@ -143,8 +149,7 @@ public final Builder stopwordsPath(@Nullable String value) { /** * Builds a {@link CjkAnalyzer}. * - * @throws NullPointerException - * if some required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public CjkAnalyzer build() { _checkSingleUse(); @@ -160,15 +165,29 @@ public CjkAnalyzer build() { */ public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( Builder::new, - CjkAnalyzer::setupLanguageAnalyzerDeserializer + CjkAnalyzer::setupCjkAnalyzerDeserializer ); - protected static void setupLanguageAnalyzerDeserializer(ObjectDeserializer op) { - + protected static void setupCjkAnalyzerDeserializer(ObjectDeserializer op) { op.add(Builder::stopwords, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "stopwords"); op.add(Builder::stopwordsPath, JsonpDeserializer.stringDeserializer(), "stopwords_path"); op.ignore("type"); } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.stopwords); + result = 31 * result + Objects.hashCode(this.stopwordsPath); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CjkAnalyzer other = (CjkAnalyzer) o; + return Objects.equals(this.stopwords, other.stopwords) && Objects.equals(this.stopwordsPath, other.stopwordsPath); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/CustomAnalyzer.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/CustomAnalyzer.java similarity index 82% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/CustomAnalyzer.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/CustomAnalyzer.java index 4d038b8e71..be8b2dfc40 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/CustomAnalyzer.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/CustomAnalyzer.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,9 +56,13 @@ // typedef: _types.analysis.CustomAnalyzer @JsonpDeserializable -public class CustomAnalyzer implements AnalyzerVariant, JsonpSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CustomAnalyzer implements AnalyzerVariant, PlainJsonSerializable { + + @Nonnull private final List charFilter; + @Nonnull private final List filter; @Nullable @@ -60,26 +71,25 @@ public class CustomAnalyzer implements AnalyzerVariant, JsonpSerializable { @Nullable private final Integer positionOffsetGap; + @Nonnull private final String tokenizer; // --------------------------------------------------------------------------------------------- private CustomAnalyzer(Builder builder) { - this.charFilter = ApiTypeHelper.unmodifiable(builder.charFilter); this.filter = ApiTypeHelper.unmodifiable(builder.filter); this.positionIncrementGap = builder.positionIncrementGap; this.positionOffsetGap = builder.positionOffsetGap; this.tokenizer = ApiTypeHelper.requireNonNull(builder.tokenizer, this, "tokenizer"); - } - public static CustomAnalyzer of(Function> fn) { + public static CustomAnalyzer of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Analyzer variant kind. + * {@link Analyzer} variant kind. */ @Override public Analyzer.Kind _analyzerKind() { @@ -89,6 +99,7 @@ public Analyzer.Kind _analyzerKind() { /** * API name: {@code char_filter} */ + @Nonnull public final List charFilter() { return this.charFilter; } @@ -96,6 +107,7 @@ public final List charFilter() { /** * API name: {@code filter} */ + @Nonnull public final List filter() { return this.filter; } @@ -119,6 +131,7 @@ public final Integer positionOffsetGap() { /** * Required - API name: {@code tokenizer} */ + @Nonnull public final String tokenizer() { return this.tokenizer; } @@ -126,6 +139,7 @@ public final String tokenizer() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -133,42 +147,37 @@ 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(); - } + if (this.positionIncrementGap != null) { generator.writeKey("position_increment_gap"); generator.write(this.positionIncrementGap); - } + if (this.positionOffsetGap != null) { generator.writeKey("position_offset_gap"); generator.write(this.positionOffsetGap); - } + generator.writeKey("tokenizer"); generator.write(this.tokenizer); - } // --------------------------------------------------------------------------------------------- @@ -176,26 +185,23 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link CustomAnalyzer}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { @Nullable private List charFilter; - @Nullable private List filter; - @Nullable private Integer positionIncrementGap; - @Nullable private Integer positionOffsetGap; - private String tokenizer; /** * API name: {@code char_filter} + * *

* Adds all elements of list to charFilter. + *

*/ public final Builder charFilter(List list) { this.charFilter = _listAddAll(this.charFilter, list); @@ -204,8 +210,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); @@ -214,8 +222,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); @@ -224,8 +234,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); @@ -259,8 +271,7 @@ public final Builder tokenizer(String value) { /** * Builds a {@link CustomAnalyzer}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public CustomAnalyzer build() { _checkSingleUse(); @@ -280,7 +291,6 @@ public CustomAnalyzer build() { ); protected static void setupCustomAnalyzerDeserializer(ObjectDeserializer op) { - op.add(Builder::charFilter, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "char_filter"); op.add(Builder::filter, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "filter"); op.add(Builder::positionIncrementGap, JsonpDeserializer.integerDeserializer(), "position_increment_gap"); @@ -290,4 +300,26 @@ protected static void setupCustomAnalyzerDeserializer(ObjectDeserializer stopwords; // --------------------------------------------------------------------------------------------- private DutchAnalyzer(Builder builder) { - this.stopwords = ApiTypeHelper.unmodifiable(builder.stopwords); - } - public static DutchAnalyzer of(Function> fn) { + public static DutchAnalyzer of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Analyzer variant kind. + * {@link Analyzer} variant kind. */ @Override public Analyzer.Kind _analyzerKind() { @@ -75,6 +83,7 @@ public Analyzer.Kind _analyzerKind() { /** * API name: {@code stopwords} */ + @Nonnull public final List stopwords() { return this.stopwords; } @@ -82,6 +91,7 @@ public final List stopwords() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -89,20 +99,15 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "dutch"); - if (ApiTypeHelper.isDefined(this.stopwords)) { generator.writeKey("stopwords"); generator.writeStartArray(); for (String item0 : this.stopwords) { generator.write(item0); - } generator.writeEnd(); - } - } // --------------------------------------------------------------------------------------------- @@ -110,15 +115,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link DutchAnalyzer}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { @Nullable private List stopwords; /** * API name: {@code stopwords} + * *

* Adds all elements of list to stopwords. + *

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

* Adds one or more values to stopwords. + *

*/ public final Builder stopwords(String value, String... values) { this.stopwords = _listAdd(this.stopwords, value, values); @@ -138,8 +146,7 @@ public final Builder stopwords(String value, String... values) { /** * Builds a {@link DutchAnalyzer}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public DutchAnalyzer build() { _checkSingleUse(); @@ -159,10 +166,23 @@ public DutchAnalyzer build() { ); protected static void setupDutchAnalyzerDeserializer(ObjectDeserializer op) { - op.add(Builder::stopwords, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "stopwords"); op.ignore("type"); } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.stopwords); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DutchAnalyzer other = (DutchAnalyzer) o; + return Objects.equals(this.stopwords, other.stopwords); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/FingerprintAnalyzer.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/FingerprintAnalyzer.java similarity index 81% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/FingerprintAnalyzer.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/FingerprintAnalyzer.java index 7aa510dee8..fb366da4be 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/FingerprintAnalyzer.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/FingerprintAnalyzer.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,54 +56,48 @@ // typedef: _types.analysis.FingerprintAnalyzer @JsonpDeserializable -public class FingerprintAnalyzer implements AnalyzerVariant, JsonpSerializable { - @Nullable - private final String version; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class FingerprintAnalyzer implements AnalyzerVariant, PlainJsonSerializable { private final int maxOutputSize; private final boolean preserveOriginal; + @Nonnull private final String separator; + @Nonnull private final List stopwords; @Nullable private final String stopwordsPath; + @Nullable + private final String version; + // --------------------------------------------------------------------------------------------- private FingerprintAnalyzer(Builder builder) { - - this.version = builder.version; this.maxOutputSize = ApiTypeHelper.requireNonNull(builder.maxOutputSize, this, "maxOutputSize"); this.preserveOriginal = ApiTypeHelper.requireNonNull(builder.preserveOriginal, this, "preserveOriginal"); this.separator = ApiTypeHelper.requireNonNull(builder.separator, this, "separator"); this.stopwords = ApiTypeHelper.unmodifiable(builder.stopwords); this.stopwordsPath = builder.stopwordsPath; - + this.version = builder.version; } - public static FingerprintAnalyzer of(Function> fn) { + public static FingerprintAnalyzer of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Analyzer variant kind. + * {@link Analyzer} variant kind. */ @Override public Analyzer.Kind _analyzerKind() { return Analyzer.Kind.Fingerprint; } - /** - * API name: {@code version} - */ - @Nullable - public final String version() { - return this.version; - } - /** * Required - API name: {@code max_output_size} */ @@ -114,6 +115,7 @@ public final boolean preserveOriginal() { /** * Required - API name: {@code separator} */ + @Nonnull public final String separator() { return this.separator; } @@ -121,6 +123,7 @@ public final String separator() { /** * API name: {@code stopwords} */ + @Nonnull public final List stopwords() { return this.stopwords; } @@ -133,9 +136,18 @@ public final String stopwordsPath() { return this.stopwordsPath; } + /** + * API name: {@code version} + */ + @Nullable + public final String version() { + return this.version; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -143,14 +155,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "fingerprint"); - - if (this.version != null) { - generator.writeKey("version"); - generator.write(this.version); - - } generator.writeKey("max_output_size"); generator.write(this.maxOutputSize); @@ -165,17 +170,19 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartArray(); for (String item0 : this.stopwords) { generator.write(item0); - } generator.writeEnd(); - } + if (this.stopwordsPath != null) { generator.writeKey("stopwords_path"); generator.write(this.stopwordsPath); - } + if (this.version != null) { + generator.writeKey("version"); + generator.write(this.version); + } } // --------------------------------------------------------------------------------------------- @@ -183,30 +190,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link FingerprintAnalyzer}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private String version; - private Integer maxOutputSize; - private Boolean preserveOriginal; - private String separator; - @Nullable private List stopwords; - @Nullable private String stopwordsPath; - - /** - * API name: {@code version} - */ - public final Builder version(@Nullable String value) { - this.version = value; - return this; - } + @Nullable + private String version; /** * Required - API name: {@code max_output_size} @@ -234,8 +227,10 @@ public final Builder separator(String value) { /** * API name: {@code stopwords} + * *

* Adds all elements of list to stopwords. + *

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

* Adds one or more values to stopwords. + *

*/ public final Builder stopwords(String value, String... values) { this.stopwords = _listAdd(this.stopwords, value, values); @@ -260,11 +257,18 @@ public final Builder stopwordsPath(@Nullable String value) { return this; } + /** + * API name: {@code version} + */ + public final Builder version(@Nullable String value) { + this.version = value; + return this; + } + /** * Builds a {@link FingerprintAnalyzer}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public FingerprintAnalyzer build() { _checkSingleUse(); @@ -284,15 +288,38 @@ public FingerprintAnalyzer build() { ); protected static void setupFingerprintAnalyzerDeserializer(ObjectDeserializer op) { - - op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); op.add(Builder::maxOutputSize, JsonpDeserializer.integerDeserializer(), "max_output_size"); op.add(Builder::preserveOriginal, JsonpDeserializer.booleanDeserializer(), "preserve_original"); op.add(Builder::separator, JsonpDeserializer.stringDeserializer(), "separator"); op.add(Builder::stopwords, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "stopwords"); op.add(Builder::stopwordsPath, JsonpDeserializer.stringDeserializer(), "stopwords_path"); + op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); op.ignore("type"); } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Integer.hashCode(this.maxOutputSize); + result = 31 * result + Boolean.hashCode(this.preserveOriginal); + result = 31 * result + this.separator.hashCode(); + result = 31 * result + Objects.hashCode(this.stopwords); + result = 31 * result + Objects.hashCode(this.stopwordsPath); + result = 31 * result + Objects.hashCode(this.version); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + FingerprintAnalyzer other = (FingerprintAnalyzer) o; + return this.maxOutputSize == other.maxOutputSize + && this.preserveOriginal == other.preserveOriginal + && this.separator.equals(other.separator) + && Objects.equals(this.stopwords, other.stopwords) + && Objects.equals(this.stopwordsPath, other.stopwordsPath) + && Objects.equals(this.version, other.version); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/IcuAnalyzer.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/IcuAnalyzer.java similarity index 79% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/IcuAnalyzer.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/IcuAnalyzer.java index a93c09dc1b..906df8ef2b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/IcuAnalyzer.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/IcuAnalyzer.java @@ -30,16 +30,22 @@ * 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 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.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; @@ -47,26 +53,28 @@ // typedef: _types.analysis.IcuAnalyzer @JsonpDeserializable -public class IcuAnalyzer implements AnalyzerVariant, JsonpSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class IcuAnalyzer implements AnalyzerVariant, PlainJsonSerializable { + + @Nonnull private final IcuNormalizationType method; + @Nonnull private final IcuNormalizationMode mode; // --------------------------------------------------------------------------------------------- private IcuAnalyzer(Builder builder) { - this.method = ApiTypeHelper.requireNonNull(builder.method, this, "method"); this.mode = ApiTypeHelper.requireNonNull(builder.mode, this, "mode"); - } - public static IcuAnalyzer of(Function> fn) { + public static IcuAnalyzer of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Analyzer variant kind. + * {@link Analyzer} variant kind. */ @Override public Analyzer.Kind _analyzerKind() { @@ -76,6 +84,7 @@ public Analyzer.Kind _analyzerKind() { /** * Required - API name: {@code method} */ + @Nonnull public final IcuNormalizationType method() { return this.method; } @@ -83,6 +92,7 @@ public final IcuNormalizationType method() { /** * Required - API name: {@code mode} */ + @Nonnull public final IcuNormalizationMode mode() { return this.mode; } @@ -90,6 +100,7 @@ public final IcuNormalizationMode mode() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -97,14 +108,12 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "icu_analyzer"); - generator.writeKey("method"); this.method.serialize(generator, mapper); + generator.writeKey("mode"); this.mode.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- @@ -112,10 +121,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link IcuAnalyzer}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private IcuNormalizationType method; - private IcuNormalizationMode mode; /** @@ -137,8 +144,7 @@ public final Builder mode(IcuNormalizationMode value) { /** * Builds a {@link IcuAnalyzer}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public IcuAnalyzer build() { _checkSingleUse(); @@ -158,11 +164,25 @@ public IcuAnalyzer build() { ); protected static void setupIcuAnalyzerDeserializer(ObjectDeserializer op) { - op.add(Builder::method, IcuNormalizationType._DESERIALIZER, "method"); op.add(Builder::mode, IcuNormalizationMode._DESERIALIZER, "mode"); op.ignore("type"); } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.method.hashCode(); + result = 31 * result + this.mode.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + IcuAnalyzer other = (IcuAnalyzer) o; + return this.method.equals(other.method) && this.mode.equals(other.mode); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/IcuNormalizationMode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/IcuNormalizationMode.java similarity index 83% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/IcuNormalizationMode.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/IcuNormalizationMode.java index bde114d68f..8dd7c72ca4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/IcuNormalizationMode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/IcuNormalizationMode.java @@ -30,18 +30,24 @@ * 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.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: _types.analysis.IcuNormalizationMode + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum IcuNormalizationMode implements JsonEnum { - Decompose("decompose"), - Compose("compose"), - ; + Decompose("decompose"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/KeywordAnalyzer.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/KeywordAnalyzer.java similarity index 78% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/KeywordAnalyzer.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/KeywordAnalyzer.java index 5469ebb2b2..e07fcee2bb 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/KeywordAnalyzer.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/KeywordAnalyzer.java @@ -30,41 +30,47 @@ * 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.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; 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.KeywordAnalyzer @JsonpDeserializable -public class KeywordAnalyzer implements AnalyzerVariant, JsonpSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class KeywordAnalyzer implements AnalyzerVariant, PlainJsonSerializable { + @Nullable private final String version; // --------------------------------------------------------------------------------------------- private KeywordAnalyzer(Builder builder) { - this.version = builder.version; - } - public static KeywordAnalyzer of(Function> fn) { + public static KeywordAnalyzer of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Analyzer variant kind. + * {@link Analyzer} variant kind. */ @Override public Analyzer.Kind _analyzerKind() { @@ -82,6 +88,7 @@ public final String version() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -89,15 +96,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "keyword"); - if (this.version != null) { generator.writeKey("version"); generator.write(this.version); - } - } // --------------------------------------------------------------------------------------------- @@ -105,7 +108,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link KeywordAnalyzer}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { @Nullable private String version; @@ -121,8 +123,7 @@ public final Builder version(@Nullable String value) { /** * Builds a {@link KeywordAnalyzer}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public KeywordAnalyzer build() { _checkSingleUse(); @@ -142,10 +143,23 @@ public KeywordAnalyzer build() { ); protected static void setupKeywordAnalyzerDeserializer(ObjectDeserializer op) { - op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); op.ignore("type"); } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.version); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + KeywordAnalyzer other = (KeywordAnalyzer) o; + return Objects.equals(this.version, other.version); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/KuromojiAnalyzer.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/KuromojiAnalyzer.java similarity index 79% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/KuromojiAnalyzer.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/KuromojiAnalyzer.java index 21200f3b7b..e11721df24 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/KuromojiAnalyzer.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/KuromojiAnalyzer.java @@ -30,17 +30,24 @@ * 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.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; @@ -48,7 +55,10 @@ // typedef: _types.analysis.KuromojiAnalyzer @JsonpDeserializable -public class KuromojiAnalyzer implements AnalyzerVariant, JsonpSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class KuromojiAnalyzer implements AnalyzerVariant, PlainJsonSerializable { + + @Nonnull private final KuromojiTokenizationMode mode; @Nullable @@ -57,18 +67,16 @@ public class KuromojiAnalyzer implements AnalyzerVariant, JsonpSerializable { // --------------------------------------------------------------------------------------------- private KuromojiAnalyzer(Builder builder) { - this.mode = ApiTypeHelper.requireNonNull(builder.mode, this, "mode"); this.userDictionary = builder.userDictionary; - } - public static KuromojiAnalyzer of(Function> fn) { + public static KuromojiAnalyzer of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Analyzer variant kind. + * {@link Analyzer} variant kind. */ @Override public Analyzer.Kind _analyzerKind() { @@ -78,6 +86,7 @@ public Analyzer.Kind _analyzerKind() { /** * Required - API name: {@code mode} */ + @Nonnull public final KuromojiTokenizationMode mode() { return this.mode; } @@ -93,6 +102,7 @@ public final String userDictionary() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -100,17 +110,14 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "kuromoji"); - generator.writeKey("mode"); this.mode.serialize(generator, mapper); + if (this.userDictionary != null) { generator.writeKey("user_dictionary"); generator.write(this.userDictionary); - } - } // --------------------------------------------------------------------------------------------- @@ -118,10 +125,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link KuromojiAnalyzer}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private KuromojiTokenizationMode mode; - @Nullable private String userDictionary; @@ -144,8 +149,7 @@ public final Builder userDictionary(@Nullable String value) { /** * Builds a {@link KuromojiAnalyzer}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public KuromojiAnalyzer build() { _checkSingleUse(); @@ -165,11 +169,25 @@ public KuromojiAnalyzer build() { ); protected static void setupKuromojiAnalyzerDeserializer(ObjectDeserializer op) { - op.add(Builder::mode, KuromojiTokenizationMode._DESERIALIZER, "mode"); op.add(Builder::userDictionary, JsonpDeserializer.stringDeserializer(), "user_dictionary"); op.ignore("type"); } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.mode.hashCode(); + result = 31 * result + Objects.hashCode(this.userDictionary); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + KuromojiAnalyzer other = (KuromojiAnalyzer) o; + return this.mode.equals(other.mode) && Objects.equals(this.userDictionary, other.userDictionary); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/Language.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/Language.java similarity index 88% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/Language.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/Language.java index c90e4eeec3..331dc2083f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/Language.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/Language.java @@ -30,12 +30,20 @@ * 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.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: _types.analysis.Language + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum Language implements JsonEnum { Arabic("Arabic"), @@ -101,11 +109,9 @@ public enum Language implements JsonEnum { Swedish("Swedish"), - Turkish("Turkish"), - Thai("Thai"), - ; + Turkish("Turkish"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/LanguageAnalyzer.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/LanguageAnalyzer.java similarity index 80% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/LanguageAnalyzer.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/LanguageAnalyzer.java index d2684dc242..0c187e6cb8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/LanguageAnalyzer.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/LanguageAnalyzer.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,54 +56,50 @@ // typedef: _types.analysis.LanguageAnalyzer @JsonpDeserializable -public class LanguageAnalyzer implements AnalyzerVariant, JsonpSerializable { - @Nullable - private final String version; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class LanguageAnalyzer implements AnalyzerVariant, PlainJsonSerializable { + @Nonnull private final Language language; + @Nonnull private final List stemExclusion; + @Nonnull private final List stopwords; @Nullable private final String stopwordsPath; + @Nullable + private final String version; + // --------------------------------------------------------------------------------------------- private LanguageAnalyzer(Builder builder) { - - this.version = builder.version; this.language = ApiTypeHelper.requireNonNull(builder.language, this, "language"); this.stemExclusion = ApiTypeHelper.unmodifiableRequired(builder.stemExclusion, this, "stemExclusion"); this.stopwords = ApiTypeHelper.unmodifiable(builder.stopwords); this.stopwordsPath = builder.stopwordsPath; - + this.version = builder.version; } - public static LanguageAnalyzer of(Function> fn) { + public static LanguageAnalyzer of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Analyzer variant kind. + * {@link Analyzer} variant kind. */ @Override public Analyzer.Kind _analyzerKind() { return Analyzer.Kind.Language; } - /** - * API name: {@code version} - */ - @Nullable - public final String version() { - return this.version; - } - /** * Required - API name: {@code language} */ + @Nonnull public final Language language() { return this.language; } @@ -104,6 +107,7 @@ public final Language language() { /** * Required - API name: {@code stem_exclusion} */ + @Nonnull public final List stemExclusion() { return this.stemExclusion; } @@ -111,6 +115,7 @@ public final List stemExclusion() { /** * API name: {@code stopwords} */ + @Nonnull public final List stopwords() { return this.stopwords; } @@ -123,9 +128,18 @@ public final String stopwordsPath() { return this.stopwordsPath; } + /** + * API name: {@code version} + */ + @Nullable + public final String version() { + return this.version; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -133,42 +147,35 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "language"); - - if (this.version != null) { - generator.writeKey("version"); - generator.write(this.version); - - } generator.writeKey("language"); this.language.serialize(generator, mapper); - if (ApiTypeHelper.isDefined(this.stemExclusion)) { - generator.writeKey("stem_exclusion"); - generator.writeStartArray(); - for (String item0 : this.stemExclusion) { - generator.write(item0); - - } - generator.writeEnd(); + generator.writeKey("stem_exclusion"); + generator.writeStartArray(); + for (String item0 : this.stemExclusion) { + generator.write(item0); } + generator.writeEnd(); + if (ApiTypeHelper.isDefined(this.stopwords)) { generator.writeKey("stopwords"); generator.writeStartArray(); for (String item0 : this.stopwords) { generator.write(item0); - } generator.writeEnd(); - } + if (this.stopwordsPath != null) { generator.writeKey("stopwords_path"); generator.write(this.stopwordsPath); - } + if (this.version != null) { + generator.writeKey("version"); + generator.write(this.version); + } } // --------------------------------------------------------------------------------------------- @@ -176,28 +183,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link LanguageAnalyzer}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private String version; - private Language language; - private List stemExclusion; - @Nullable private List stopwords; - @Nullable private String stopwordsPath; - - /** - * API name: {@code version} - */ - public final Builder version(@Nullable String value) { - this.version = value; - return this; - } + @Nullable + private String version; /** * Required - API name: {@code language} @@ -209,8 +203,10 @@ public final Builder language(Language value) { /** * Required - API name: {@code stem_exclusion} + * *

* Adds all elements of list to stemExclusion. + *

*/ public final Builder stemExclusion(List list) { this.stemExclusion = _listAddAll(this.stemExclusion, list); @@ -219,8 +215,10 @@ public final Builder stemExclusion(List list) { /** * Required - API name: {@code stem_exclusion} + * *

* Adds one or more values to stemExclusion. + *

*/ public final Builder stemExclusion(String value, String... values) { this.stemExclusion = _listAdd(this.stemExclusion, value, values); @@ -229,8 +227,10 @@ public final Builder stemExclusion(String value, String... values) { /** * API name: {@code stopwords} + * *

* Adds all elements of list to stopwords. + *

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

* Adds one or more values to stopwords. + *

*/ public final Builder stopwords(String value, String... values) { this.stopwords = _listAdd(this.stopwords, value, values); @@ -255,11 +257,18 @@ public final Builder stopwordsPath(@Nullable String value) { return this; } + /** + * API name: {@code version} + */ + public final Builder version(@Nullable String value) { + this.version = value; + return this; + } + /** * Builds a {@link LanguageAnalyzer}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public LanguageAnalyzer build() { _checkSingleUse(); @@ -279,14 +288,35 @@ public LanguageAnalyzer build() { ); protected static void setupLanguageAnalyzerDeserializer(ObjectDeserializer op) { - - op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); op.add(Builder::language, Language._DESERIALIZER, "language"); op.add(Builder::stemExclusion, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "stem_exclusion"); op.add(Builder::stopwords, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "stopwords"); op.add(Builder::stopwordsPath, JsonpDeserializer.stringDeserializer(), "stopwords_path"); + op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); op.ignore("type"); } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.language.hashCode(); + result = 31 * result + this.stemExclusion.hashCode(); + result = 31 * result + Objects.hashCode(this.stopwords); + result = 31 * result + Objects.hashCode(this.stopwordsPath); + result = 31 * result + Objects.hashCode(this.version); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + LanguageAnalyzer other = (LanguageAnalyzer) o; + return this.language.equals(other.language) + && this.stemExclusion.equals(other.stemExclusion) + && Objects.equals(this.stopwords, other.stopwords) + && Objects.equals(this.stopwordsPath, other.stopwordsPath) + && Objects.equals(this.version, other.version); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/NoriAnalyzer.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/NoriAnalyzer.java similarity index 81% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/NoriAnalyzer.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/NoriAnalyzer.java index 3835207d85..2984e679d9 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/NoriAnalyzer.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/NoriAnalyzer.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,49 +56,42 @@ // typedef: _types.analysis.NoriAnalyzer @JsonpDeserializable -public class NoriAnalyzer implements AnalyzerVariant, JsonpSerializable { - @Nullable - private final String version; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class NoriAnalyzer implements AnalyzerVariant, PlainJsonSerializable { @Nullable private final NoriDecompoundMode decompoundMode; + @Nonnull private final List stoptags; @Nullable private final String userDictionary; + @Nullable + private final String version; + // --------------------------------------------------------------------------------------------- private NoriAnalyzer(Builder builder) { - - this.version = builder.version; this.decompoundMode = builder.decompoundMode; this.stoptags = ApiTypeHelper.unmodifiable(builder.stoptags); this.userDictionary = builder.userDictionary; - + this.version = builder.version; } - public static NoriAnalyzer of(Function> fn) { + public static NoriAnalyzer of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Analyzer variant kind. + * {@link Analyzer} variant kind. */ @Override public Analyzer.Kind _analyzerKind() { return Analyzer.Kind.Nori; } - /** - * API name: {@code version} - */ - @Nullable - public final String version() { - return this.version; - } - /** * API name: {@code decompound_mode} */ @@ -103,6 +103,7 @@ public final NoriDecompoundMode decompoundMode() { /** * API name: {@code stoptags} */ + @Nonnull public final List stoptags() { return this.stoptags; } @@ -115,9 +116,18 @@ public final String userDictionary() { return this.userDictionary; } + /** + * API name: {@code version} + */ + @Nullable + public final String version() { + return this.version; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -125,34 +135,30 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "nori"); - - if (this.version != null) { - generator.writeKey("version"); - generator.write(this.version); - - } if (this.decompoundMode != null) { generator.writeKey("decompound_mode"); this.decompoundMode.serialize(generator, mapper); } + if (ApiTypeHelper.isDefined(this.stoptags)) { generator.writeKey("stoptags"); generator.writeStartArray(); for (String item0 : this.stoptags) { generator.write(item0); - } generator.writeEnd(); - } + if (this.userDictionary != null) { generator.writeKey("user_dictionary"); generator.write(this.userDictionary); - } + if (this.version != null) { + generator.writeKey("version"); + generator.write(this.version); + } } // --------------------------------------------------------------------------------------------- @@ -160,27 +166,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link NoriAnalyzer}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private String version; - @Nullable private NoriDecompoundMode decompoundMode; - @Nullable private List stoptags; - @Nullable private String userDictionary; - - /** - * API name: {@code version} - */ - public final Builder version(@Nullable String value) { - this.version = value; - return this; - } + @Nullable + private String version; /** * API name: {@code decompound_mode} @@ -192,8 +186,10 @@ public final Builder decompoundMode(@Nullable NoriDecompoundMode value) { /** * API name: {@code stoptags} + * *

* Adds all elements of list to stoptags. + *

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

* Adds one or more values to stoptags. + *

*/ public final Builder stoptags(String value, String... values) { this.stoptags = _listAdd(this.stoptags, value, values); @@ -218,11 +216,18 @@ public final Builder userDictionary(@Nullable String value) { return this; } + /** + * API name: {@code version} + */ + public final Builder version(@Nullable String value) { + this.version = value; + return this; + } + /** * Builds a {@link NoriAnalyzer}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public NoriAnalyzer build() { _checkSingleUse(); @@ -242,13 +247,32 @@ public NoriAnalyzer build() { ); protected static void setupNoriAnalyzerDeserializer(ObjectDeserializer op) { - - op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); op.add(Builder::decompoundMode, NoriDecompoundMode._DESERIALIZER, "decompound_mode"); op.add(Builder::stoptags, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "stoptags"); op.add(Builder::userDictionary, JsonpDeserializer.stringDeserializer(), "user_dictionary"); + op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); op.ignore("type"); } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.decompoundMode); + result = 31 * result + Objects.hashCode(this.stoptags); + result = 31 * result + Objects.hashCode(this.userDictionary); + result = 31 * result + Objects.hashCode(this.version); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + NoriAnalyzer other = (NoriAnalyzer) o; + return Objects.equals(this.decompoundMode, other.decompoundMode) + && Objects.equals(this.stoptags, other.stoptags) + && Objects.equals(this.userDictionary, other.userDictionary) + && Objects.equals(this.version, other.version); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/PatternAnalyzer.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/PatternAnalyzer.java similarity index 81% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/PatternAnalyzer.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/PatternAnalyzer.java index 084249bb3f..618383c7f3 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/PatternAnalyzer.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/PatternAnalyzer.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,9 +56,8 @@ // typedef: _types.analysis.PatternAnalyzer @JsonpDeserializable -public class PatternAnalyzer implements AnalyzerVariant, JsonpSerializable { - @Nullable - private final String version; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PatternAnalyzer implements AnalyzerVariant, PlainJsonSerializable { @Nullable private final String flags; @@ -59,42 +65,37 @@ public class PatternAnalyzer implements AnalyzerVariant, JsonpSerializable { @Nullable private final Boolean lowercase; + @Nonnull private final String pattern; + @Nonnull private final List stopwords; + @Nullable + private final String version; + // --------------------------------------------------------------------------------------------- private PatternAnalyzer(Builder builder) { - - this.version = builder.version; this.flags = builder.flags; this.lowercase = builder.lowercase; this.pattern = ApiTypeHelper.requireNonNull(builder.pattern, this, "pattern"); this.stopwords = ApiTypeHelper.unmodifiable(builder.stopwords); - + this.version = builder.version; } - public static PatternAnalyzer of(Function> fn) { + public static PatternAnalyzer of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Analyzer variant kind. + * {@link Analyzer} variant kind. */ @Override public Analyzer.Kind _analyzerKind() { return Analyzer.Kind.Pattern; } - /** - * API name: {@code version} - */ - @Nullable - public final String version() { - return this.version; - } - /** * API name: {@code flags} */ @@ -114,6 +115,7 @@ public final Boolean lowercase() { /** * Required - API name: {@code pattern} */ + @Nonnull public final String pattern() { return this.pattern; } @@ -121,13 +123,23 @@ public final String pattern() { /** * API name: {@code stopwords} */ + @Nonnull public final List stopwords() { return this.stopwords; } + /** + * API name: {@code version} + */ + @Nullable + public final String version() { + return this.version; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -135,24 +147,17 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "pattern"); - - if (this.version != null) { - generator.writeKey("version"); - generator.write(this.version); - - } if (this.flags != null) { generator.writeKey("flags"); generator.write(this.flags); - } + if (this.lowercase != null) { generator.writeKey("lowercase"); generator.write(this.lowercase); - } + generator.writeKey("pattern"); generator.write(this.pattern); @@ -161,12 +166,14 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartArray(); for (String item0 : this.stopwords) { generator.write(item0); - } generator.writeEnd(); - } + if (this.version != null) { + generator.writeKey("version"); + generator.write(this.version); + } } // --------------------------------------------------------------------------------------------- @@ -174,29 +181,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link PatternAnalyzer}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private String version; - @Nullable private String flags; - @Nullable private Boolean lowercase; - private String pattern; - @Nullable private List stopwords; - - /** - * API name: {@code version} - */ - public final Builder version(@Nullable String value) { - this.version = value; - return this; - } + @Nullable + private String version; /** * API name: {@code flags} @@ -224,8 +218,10 @@ public final Builder pattern(String value) { /** * API name: {@code stopwords} + * *

* Adds all elements of list to stopwords. + *

*/ public final Builder stopwords(List list) { this.stopwords = _listAddAll(this.stopwords, list); @@ -234,19 +230,28 @@ public final Builder stopwords(List list) { /** * API name: {@code stopwords} + * *

* Adds one or more values to stopwords. + *

*/ public final Builder stopwords(String value, String... values) { this.stopwords = _listAdd(this.stopwords, value, values); return this; } + /** + * API name: {@code version} + */ + public final Builder version(@Nullable String value) { + this.version = value; + return this; + } + /** * Builds a {@link PatternAnalyzer}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public PatternAnalyzer build() { _checkSingleUse(); @@ -266,14 +271,35 @@ public PatternAnalyzer build() { ); protected static void setupPatternAnalyzerDeserializer(ObjectDeserializer op) { - - op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); op.add(Builder::flags, JsonpDeserializer.stringDeserializer(), "flags"); op.add(Builder::lowercase, JsonpDeserializer.booleanDeserializer(), "lowercase"); op.add(Builder::pattern, JsonpDeserializer.stringDeserializer(), "pattern"); op.add(Builder::stopwords, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "stopwords"); + op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); op.ignore("type"); } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.flags); + result = 31 * result + Objects.hashCode(this.lowercase); + result = 31 * result + this.pattern.hashCode(); + result = 31 * result + Objects.hashCode(this.stopwords); + result = 31 * result + Objects.hashCode(this.version); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PatternAnalyzer other = (PatternAnalyzer) o; + return Objects.equals(this.flags, other.flags) + && Objects.equals(this.lowercase, other.lowercase) + && this.pattern.equals(other.pattern) + && Objects.equals(this.stopwords, other.stopwords) + && Objects.equals(this.version, other.version); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/SimpleAnalyzer.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/SimpleAnalyzer.java similarity index 78% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/SimpleAnalyzer.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/SimpleAnalyzer.java index bf37c3ce30..00a541d5d1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/SimpleAnalyzer.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/SimpleAnalyzer.java @@ -30,41 +30,47 @@ * 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.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; 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.SimpleAnalyzer @JsonpDeserializable -public class SimpleAnalyzer implements AnalyzerVariant, JsonpSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SimpleAnalyzer implements AnalyzerVariant, PlainJsonSerializable { + @Nullable private final String version; // --------------------------------------------------------------------------------------------- private SimpleAnalyzer(Builder builder) { - this.version = builder.version; - } - public static SimpleAnalyzer of(Function> fn) { + public static SimpleAnalyzer of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Analyzer variant kind. + * {@link Analyzer} variant kind. */ @Override public Analyzer.Kind _analyzerKind() { @@ -82,6 +88,7 @@ public final String version() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -89,15 +96,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "simple"); - if (this.version != null) { generator.writeKey("version"); generator.write(this.version); - } - } // --------------------------------------------------------------------------------------------- @@ -105,7 +108,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link SimpleAnalyzer}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { @Nullable private String version; @@ -121,8 +123,7 @@ public final Builder version(@Nullable String value) { /** * Builds a {@link SimpleAnalyzer}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public SimpleAnalyzer build() { _checkSingleUse(); @@ -142,10 +143,23 @@ public SimpleAnalyzer build() { ); protected static void setupSimpleAnalyzerDeserializer(ObjectDeserializer op) { - op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); op.ignore("type"); } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.version); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SimpleAnalyzer other = (SimpleAnalyzer) o; + return Objects.equals(this.version, other.version); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/SmartcnAnalyzer.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/SmartcnAnalyzer.java similarity index 64% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/SmartcnAnalyzer.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/SmartcnAnalyzer.java index 9f782f37b6..e94766c298 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/SmartcnAnalyzer.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/SmartcnAnalyzer.java @@ -6,36 +6,40 @@ * compatible open source license. */ +//---------------------------------------------------- +// 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.LanguageAnalyzer +// typedef: _types.analysis.SmartcnAnalyzer @JsonpDeserializable -public class SmartcnAnalyzer implements AnalyzerVariant, JsonpSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SmartcnAnalyzer implements AnalyzerVariant, PlainJsonSerializable { // --------------------------------------------------------------------------------------------- - private SmartcnAnalyzer(Builder builder) { - - } + private SmartcnAnalyzer(Builder builder) {} - public static SmartcnAnalyzer of(Function> fn) { + public static SmartcnAnalyzer of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Analyzer variant kind. + * {@link Analyzer} variant kind. */ @Override public Analyzer.Kind _analyzerKind() { @@ -45,6 +49,7 @@ public Analyzer.Kind _analyzerKind() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -52,9 +57,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.write("type", Analyzer.Kind.Smartcn.jsonValue()); - + generator.write("type", "smartcn"); } // --------------------------------------------------------------------------------------------- @@ -62,14 +65,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link SmartcnAnalyzer}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { /** * Builds a {@link SmartcnAnalyzer}. * - * @throws NullPointerException - * if some required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public SmartcnAnalyzer build() { _checkSingleUse(); @@ -85,12 +86,24 @@ public SmartcnAnalyzer build() { */ public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( Builder::new, - SmartcnAnalyzer::setupLanguageAnalyzerDeserializer + SmartcnAnalyzer::setupSmartcnAnalyzerDeserializer ); - protected static void setupLanguageAnalyzerDeserializer(ObjectDeserializer op) { + protected static void setupSmartcnAnalyzerDeserializer(ObjectDeserializer op) { op.ignore("type"); } + @Override + public int hashCode() { + int result = 17; + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/SnowballAnalyzer.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/SnowballAnalyzer.java similarity index 80% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/SnowballAnalyzer.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/SnowballAnalyzer.java index b4e519bfac..f5614ae206 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/SnowballAnalyzer.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/SnowballAnalyzer.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,47 +56,42 @@ // typedef: _types.analysis.SnowballAnalyzer @JsonpDeserializable -public class SnowballAnalyzer implements AnalyzerVariant, JsonpSerializable { - @Nullable - private final String version; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SnowballAnalyzer implements AnalyzerVariant, PlainJsonSerializable { + @Nonnull private final SnowballLanguage language; + @Nonnull private final List stopwords; + @Nullable + private final String version; + // --------------------------------------------------------------------------------------------- private SnowballAnalyzer(Builder builder) { - - this.version = builder.version; this.language = ApiTypeHelper.requireNonNull(builder.language, this, "language"); this.stopwords = ApiTypeHelper.unmodifiable(builder.stopwords); - + this.version = builder.version; } - public static SnowballAnalyzer of(Function> fn) { + public static SnowballAnalyzer of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Analyzer variant kind. + * {@link Analyzer} variant kind. */ @Override public Analyzer.Kind _analyzerKind() { return Analyzer.Kind.Snowball; } - /** - * API name: {@code version} - */ - @Nullable - public final String version() { - return this.version; - } - /** * Required - API name: {@code language} */ + @Nonnull public final SnowballLanguage language() { return this.language; } @@ -97,13 +99,23 @@ public final SnowballLanguage language() { /** * API name: {@code stopwords} */ + @Nonnull public final List stopwords() { return this.stopwords; } + /** + * API name: {@code version} + */ + @Nullable + public final String version() { + return this.version; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -111,27 +123,23 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "snowball"); - - if (this.version != null) { - generator.writeKey("version"); - generator.write(this.version); - - } generator.writeKey("language"); this.language.serialize(generator, mapper); + if (ApiTypeHelper.isDefined(this.stopwords)) { generator.writeKey("stopwords"); generator.writeStartArray(); for (String item0 : this.stopwords) { generator.write(item0); - } generator.writeEnd(); - } + if (this.version != null) { + generator.writeKey("version"); + generator.write(this.version); + } } // --------------------------------------------------------------------------------------------- @@ -139,23 +147,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link SnowballAnalyzer}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private String version; - private SnowballLanguage language; - @Nullable private List stopwords; - - /** - * API name: {@code version} - */ - public final Builder version(@Nullable String value) { - this.version = value; - return this; - } + @Nullable + private String version; /** * Required - API name: {@code language} @@ -167,8 +164,10 @@ public final Builder language(SnowballLanguage value) { /** * API name: {@code stopwords} + * *

* Adds all elements of list to stopwords. + *

*/ public final Builder stopwords(List list) { this.stopwords = _listAddAll(this.stopwords, list); @@ -177,19 +176,28 @@ public final Builder stopwords(List list) { /** * API name: {@code stopwords} + * *

* Adds one or more values to stopwords. + *

*/ public final Builder stopwords(String value, String... values) { this.stopwords = _listAdd(this.stopwords, value, values); return this; } + /** + * API name: {@code version} + */ + public final Builder version(@Nullable String value) { + this.version = value; + return this; + } + /** * Builds a {@link SnowballAnalyzer}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public SnowballAnalyzer build() { _checkSingleUse(); @@ -209,12 +217,29 @@ public SnowballAnalyzer build() { ); protected static void setupSnowballAnalyzerDeserializer(ObjectDeserializer op) { - - op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); op.add(Builder::language, SnowballLanguage._DESERIALIZER, "language"); op.add(Builder::stopwords, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "stopwords"); + op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); op.ignore("type"); } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.language.hashCode(); + result = 31 * result + Objects.hashCode(this.stopwords); + result = 31 * result + Objects.hashCode(this.version); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SnowballAnalyzer other = (SnowballAnalyzer) o; + return this.language.equals(other.language) + && Objects.equals(this.stopwords, other.stopwords) + && Objects.equals(this.version, other.version); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/StandardAnalyzer.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/StandardAnalyzer.java similarity index 80% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/StandardAnalyzer.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/StandardAnalyzer.java index 75b20be78b..30e175ce09 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/StandardAnalyzer.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/StandardAnalyzer.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,27 +56,28 @@ // typedef: _types.analysis.StandardAnalyzer @JsonpDeserializable -public class StandardAnalyzer implements AnalyzerVariant, JsonpSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class StandardAnalyzer implements AnalyzerVariant, PlainJsonSerializable { + @Nullable private final Integer maxTokenLength; + @Nonnull private final List stopwords; // --------------------------------------------------------------------------------------------- private StandardAnalyzer(Builder builder) { - this.maxTokenLength = builder.maxTokenLength; this.stopwords = ApiTypeHelper.unmodifiable(builder.stopwords); - } - public static StandardAnalyzer of(Function> fn) { + public static StandardAnalyzer of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Analyzer variant kind. + * {@link Analyzer} variant kind. */ @Override public Analyzer.Kind _analyzerKind() { @@ -87,6 +95,7 @@ public final Integer maxTokenLength() { /** * API name: {@code stopwords} */ + @Nonnull public final List stopwords() { return this.stopwords; } @@ -94,6 +103,7 @@ public final List stopwords() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -101,25 +111,20 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "standard"); - if (this.maxTokenLength != null) { generator.writeKey("max_token_length"); generator.write(this.maxTokenLength); - } + if (ApiTypeHelper.isDefined(this.stopwords)) { generator.writeKey("stopwords"); generator.writeStartArray(); for (String item0 : this.stopwords) { generator.write(item0); - } generator.writeEnd(); - } - } // --------------------------------------------------------------------------------------------- @@ -127,11 +132,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link StandardAnalyzer}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { @Nullable private Integer maxTokenLength; - @Nullable private List stopwords; @@ -145,8 +148,10 @@ public final Builder maxTokenLength(@Nullable Integer value) { /** * API name: {@code stopwords} + * *

* Adds all elements of list to stopwords. + *

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

* Adds one or more values to stopwords. + *

*/ public final Builder stopwords(String value, String... values) { this.stopwords = _listAdd(this.stopwords, value, values); @@ -166,8 +173,7 @@ public final Builder stopwords(String value, String... values) { /** * Builds a {@link StandardAnalyzer}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public StandardAnalyzer build() { _checkSingleUse(); @@ -187,11 +193,25 @@ public StandardAnalyzer build() { ); protected static void setupStandardAnalyzerDeserializer(ObjectDeserializer op) { - op.add(Builder::maxTokenLength, JsonpDeserializer.integerDeserializer(), "max_token_length"); op.add(Builder::stopwords, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "stopwords"); op.ignore("type"); } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.maxTokenLength); + result = 31 * result + Objects.hashCode(this.stopwords); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + StandardAnalyzer other = (StandardAnalyzer) o; + return Objects.equals(this.maxTokenLength, other.maxTokenLength) && Objects.equals(this.stopwords, other.stopwords); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/StopAnalyzer.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/StopAnalyzer.java similarity index 81% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/StopAnalyzer.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/StopAnalyzer.java index 31fed1d9c4..8a6d37cae7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/StopAnalyzer.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/StopAnalyzer.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,48 +56,42 @@ // typedef: _types.analysis.StopAnalyzer @JsonpDeserializable -public class StopAnalyzer implements AnalyzerVariant, JsonpSerializable { - @Nullable - private final String version; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class StopAnalyzer implements AnalyzerVariant, PlainJsonSerializable { + @Nonnull private final List stopwords; @Nullable private final String stopwordsPath; + @Nullable + private final String version; + // --------------------------------------------------------------------------------------------- private StopAnalyzer(Builder builder) { - - this.version = builder.version; this.stopwords = ApiTypeHelper.unmodifiable(builder.stopwords); this.stopwordsPath = builder.stopwordsPath; - + this.version = builder.version; } - public static StopAnalyzer of(Function> fn) { + public static StopAnalyzer of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Analyzer variant kind. + * {@link Analyzer} variant kind. */ @Override public Analyzer.Kind _analyzerKind() { return Analyzer.Kind.Stop; } - /** - * API name: {@code version} - */ - @Nullable - public final String version() { - return this.version; - } - /** * API name: {@code stopwords} */ + @Nonnull public final List stopwords() { return this.stopwords; } @@ -103,9 +104,18 @@ public final String stopwordsPath() { return this.stopwordsPath; } + /** + * API name: {@code version} + */ + @Nullable + public final String version() { + return this.version; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -113,30 +123,25 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "stop"); - - if (this.version != null) { - generator.writeKey("version"); - generator.write(this.version); - - } if (ApiTypeHelper.isDefined(this.stopwords)) { generator.writeKey("stopwords"); generator.writeStartArray(); for (String item0 : this.stopwords) { generator.write(item0); - } generator.writeEnd(); - } + if (this.stopwordsPath != null) { generator.writeKey("stopwords_path"); generator.write(this.stopwordsPath); - } + if (this.version != null) { + generator.writeKey("version"); + generator.write(this.version); + } } // --------------------------------------------------------------------------------------------- @@ -144,29 +149,20 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link StopAnalyzer}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private String version; - @Nullable private List stopwords; - @Nullable private String stopwordsPath; - - /** - * API name: {@code version} - */ - public final Builder version(@Nullable String value) { - this.version = value; - return this; - } + @Nullable + private String version; /** * API name: {@code stopwords} + * *

* Adds all elements of list to stopwords. + *

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

* Adds one or more values to stopwords. + *

*/ public final Builder stopwords(String value, String... values) { this.stopwords = _listAdd(this.stopwords, value, values); @@ -191,11 +189,18 @@ public final Builder stopwordsPath(@Nullable String value) { return this; } + /** + * API name: {@code version} + */ + public final Builder version(@Nullable String value) { + this.version = value; + return this; + } + /** * Builds a {@link StopAnalyzer}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public StopAnalyzer build() { _checkSingleUse(); @@ -215,12 +220,29 @@ public StopAnalyzer build() { ); protected static void setupStopAnalyzerDeserializer(ObjectDeserializer op) { - - op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); op.add(Builder::stopwords, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "stopwords"); op.add(Builder::stopwordsPath, JsonpDeserializer.stringDeserializer(), "stopwords_path"); + op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); op.ignore("type"); } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.stopwords); + result = 31 * result + Objects.hashCode(this.stopwordsPath); + result = 31 * result + Objects.hashCode(this.version); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + StopAnalyzer other = (StopAnalyzer) o; + return Objects.equals(this.stopwords, other.stopwords) + && Objects.equals(this.stopwordsPath, other.stopwordsPath) + && Objects.equals(this.version, other.version); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/WhitespaceAnalyzer.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/WhitespaceAnalyzer.java similarity index 78% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/WhitespaceAnalyzer.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/WhitespaceAnalyzer.java index b76c5ac4f4..abb883a0d0 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/WhitespaceAnalyzer.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/analysis/WhitespaceAnalyzer.java @@ -30,41 +30,47 @@ * 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.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; 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.WhitespaceAnalyzer @JsonpDeserializable -public class WhitespaceAnalyzer implements AnalyzerVariant, JsonpSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class WhitespaceAnalyzer implements AnalyzerVariant, PlainJsonSerializable { + @Nullable private final String version; // --------------------------------------------------------------------------------------------- private WhitespaceAnalyzer(Builder builder) { - this.version = builder.version; - } - public static WhitespaceAnalyzer of(Function> fn) { + public static WhitespaceAnalyzer of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Analyzer variant kind. + * {@link Analyzer} variant kind. */ @Override public Analyzer.Kind _analyzerKind() { @@ -82,6 +88,7 @@ public final String version() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -89,15 +96,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "whitespace"); - if (this.version != null) { generator.writeKey("version"); generator.write(this.version); - } - } // --------------------------------------------------------------------------------------------- @@ -105,7 +108,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link WhitespaceAnalyzer}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { @Nullable private String version; @@ -121,8 +123,7 @@ public final Builder version(@Nullable String value) { /** * Builds a {@link WhitespaceAnalyzer}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public WhitespaceAnalyzer build() { _checkSingleUse(); @@ -142,10 +143,23 @@ public WhitespaceAnalyzer build() { ); protected static void setupWhitespaceAnalyzerDeserializer(ObjectDeserializer op) { - op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); op.ignore("type"); } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.version); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + WhitespaceAnalyzer other = (WhitespaceAnalyzer) o; + return Objects.equals(this.version, other.version); + } } diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/experiments/ParsingTests.java b/java-client/src/test/java/org/opensearch/client/opensearch/experiments/ParsingTests.java index c22988ba62..94120cd769 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/experiments/ParsingTests.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/experiments/ParsingTests.java @@ -126,7 +126,7 @@ public void testIndexSettingsMappingParsing() { @Test public void testSmartcn_Analyzer() { - final Analyzer analyzer = new Analyzer.Builder().smartcn().build(); + final Analyzer analyzer = new Analyzer.Builder().smartcn(s -> s).build(); assertTrue(analyzer.isSmartcn()); 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 a65fe3dece..0bec0ea470 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,6 +32,7 @@ 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", "TokenFilter"), so -> so.withShouldGenerate(ShouldGenerate.Always)) .with(schema("_common.analysis", "Tokenizer"), so -> so.withShouldGenerate(ShouldGenerate.Always))