Skip to content

Commit

Permalink
[codegen] Update to latest API spec
Browse files Browse the repository at this point in the history
  • Loading branch information
swallez committed Mar 14, 2024
1 parent 4854e7d commit f3751c6
Show file tree
Hide file tree
Showing 20 changed files with 655 additions and 361 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
* specification</a>
*/
@JsonpDeserializable
public class IcuTokenizer extends TokenizerBase implements TokenizerDefinitionVariant, TokenFilterDefinitionVariant {
public class IcuTokenizer extends TokenizerBase implements TokenizerDefinitionVariant {
private final String ruleFiles;

// ---------------------------------------------------------------------------------------------
Expand All @@ -79,14 +79,6 @@ public TokenizerDefinition.Kind _tokenizerDefinitionKind() {
return TokenizerDefinition.Kind.IcuTokenizer;
}

/**
* TokenFilterDefinition variant kind.
*/
@Override
public TokenFilterDefinition.Kind _tokenFilterDefinitionKind() {
return TokenFilterDefinition.Kind.IcuTokenizer;
}

/**
* Required - API name: {@code rule_files}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ public enum Kind implements JsonEnum {

IcuNormalizer("icu_normalizer"),

IcuTokenizer("icu_tokenizer"),

IcuTransform("icu_transform"),

Kstem("kstem"),
Expand Down Expand Up @@ -454,23 +452,6 @@ public IcuNormalizationTokenFilter icuNormalizer() {
return TaggedUnionUtils.get(this, Kind.IcuNormalizer);
}

/**
* Is this variant instance of kind {@code icu_tokenizer}?
*/
public boolean isIcuTokenizer() {
return _kind == Kind.IcuTokenizer;
}

/**
* Get the {@code icu_tokenizer} variant value.
*
* @throws IllegalStateException
* if the current variant is not of the {@code icu_tokenizer} kind.
*/
public IcuTokenizer icuTokenizer() {
return TaggedUnionUtils.get(this, Kind.IcuTokenizer);
}

/**
* Is this variant instance of kind {@code icu_transform}?
*/
Expand Down Expand Up @@ -1254,17 +1235,6 @@ public ObjectBuilder<TokenFilterDefinition> icuNormalizer(
return this.icuNormalizer(fn.apply(new IcuNormalizationTokenFilter.Builder()).build());
}

public ObjectBuilder<TokenFilterDefinition> icuTokenizer(IcuTokenizer v) {
this._kind = Kind.IcuTokenizer;
this._value = v;
return this;
}

public ObjectBuilder<TokenFilterDefinition> icuTokenizer(
Function<IcuTokenizer.Builder, ObjectBuilder<IcuTokenizer>> fn) {
return this.icuTokenizer(fn.apply(new IcuTokenizer.Builder()).build());
}

public ObjectBuilder<TokenFilterDefinition> icuTransform(IcuTransformTokenFilter v) {
this._kind = Kind.IcuTransform;
this._value = v;
Expand Down Expand Up @@ -1679,7 +1649,6 @@ protected static void setupTokenFilterDefinitionDeserializer(ObjectDeserializer<
op.add(Builder::icuCollation, IcuCollationTokenFilter._DESERIALIZER, "icu_collation");
op.add(Builder::icuFolding, IcuFoldingTokenFilter._DESERIALIZER, "icu_folding");
op.add(Builder::icuNormalizer, IcuNormalizationTokenFilter._DESERIALIZER, "icu_normalizer");
op.add(Builder::icuTokenizer, IcuTokenizer._DESERIALIZER, "icu_tokenizer");
op.add(Builder::icuTransform, IcuTransformTokenFilter._DESERIALIZER, "icu_transform");
op.add(Builder::kstem, KStemTokenFilter._DESERIALIZER, "kstem");
op.add(Builder::keepTypes, KeepTypesTokenFilter._DESERIALIZER, "keep_types");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,24 +293,6 @@ public static TokenFilterDefinition icuNormalizer(
return builder.build();
}

/**
* Creates a builder for the {@link IcuTokenizer icu_tokenizer}
* {@code TokenFilterDefinition} variant.
*/
public static IcuTokenizer.Builder icuTokenizer() {
return new IcuTokenizer.Builder();
}

/**
* Creates a TokenFilterDefinition of the {@link IcuTokenizer icu_tokenizer}
* {@code TokenFilterDefinition} variant.
*/
public static TokenFilterDefinition icuTokenizer(Function<IcuTokenizer.Builder, ObjectBuilder<IcuTokenizer>> fn) {
TokenFilterDefinition.Builder builder = new TokenFilterDefinition.Builder();
builder.icuTokenizer(fn.apply(new IcuTokenizer.Builder()).build());
return builder.build();
}

/**
* Creates a builder for the {@link IcuTransformTokenFilter icu_transform}
* {@code TokenFilterDefinition} variant.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,16 @@ public class ObjectProperty extends CorePropertyBase implements PropertyVariant
@Nullable
private final Boolean enabled;

@Nullable
private final Boolean subobjects;

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

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

this.enabled = builder.enabled;
this.subobjects = builder.subobjects;

}

Expand All @@ -88,6 +92,14 @@ public final Boolean enabled() {
return this.enabled;
}

/**
* API name: {@code subobjects}
*/
@Nullable
public final Boolean subobjects() {
return this.subobjects;
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.write("type", "object");
Expand All @@ -97,6 +109,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.write(this.enabled);

}
if (this.subobjects != null) {
generator.writeKey("subobjects");
generator.write(this.subobjects);

}

}

Expand All @@ -112,6 +129,9 @@ public static class Builder extends CorePropertyBase.AbstractBuilder<Builder>
@Nullable
private Boolean enabled;

@Nullable
private Boolean subobjects;

/**
* API name: {@code enabled}
*/
Expand All @@ -120,6 +140,14 @@ public final Builder enabled(@Nullable Boolean value) {
return this;
}

/**
* API name: {@code subobjects}
*/
public final Builder subobjects(@Nullable Boolean value) {
this.subobjects = value;
return this;
}

@Override
protected Builder self() {
return this;
Expand Down Expand Up @@ -149,6 +177,7 @@ public ObjectProperty build() {
protected static void setupObjectPropertyDeserializer(ObjectDeserializer<ObjectProperty.Builder> op) {
CorePropertyBase.setupCorePropertyBaseDeserializer(op);
op.add(Builder::enabled, JsonpDeserializer.booleanDeserializer(), "enabled");
op.add(Builder::subobjects, JsonpDeserializer.booleanDeserializer(), "subobjects");

op.ignore("type");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ public class TypeMapping implements JsonpSerializable {
@Nullable
private final Boolean enabled;

@Nullable
private final Boolean subobjects;

@Nullable
private final DataStreamTimestamp dataStreamTimestamp;

Expand All @@ -125,6 +128,7 @@ private TypeMapping(Builder builder) {
this.source = builder.source;
this.runtime = ApiTypeHelper.unmodifiable(builder.runtime);
this.enabled = builder.enabled;
this.subobjects = builder.subobjects;
this.dataStreamTimestamp = builder.dataStreamTimestamp;

}
Expand Down Expand Up @@ -248,6 +252,14 @@ public final Boolean enabled() {
return this.enabled;
}

/**
* API name: {@code subobjects}
*/
@Nullable
public final Boolean subobjects() {
return this.subobjects;
}

/**
* API name: {@code _data_stream_timestamp}
*/
Expand Down Expand Up @@ -376,6 +388,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("enabled");
generator.write(this.enabled);

}
if (this.subobjects != null) {
generator.writeKey("subobjects");
generator.write(this.subobjects);

}
if (this.dataStreamTimestamp != null) {
generator.writeKey("_data_stream_timestamp");
Expand Down Expand Up @@ -442,6 +459,9 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder> implement
@Nullable
private Boolean enabled;

@Nullable
private Boolean subobjects;

@Nullable
private DataStreamTimestamp dataStreamTimestamp;

Expand Down Expand Up @@ -686,6 +706,14 @@ public final Builder enabled(@Nullable Boolean value) {
return this;
}

/**
* API name: {@code subobjects}
*/
public final Builder subobjects(@Nullable Boolean value) {
this.subobjects = value;
return this;
}

/**
* API name: {@code _data_stream_timestamp}
*/
Expand Down Expand Up @@ -747,6 +775,7 @@ protected static void setupTypeMappingDeserializer(ObjectDeserializer<TypeMappin
op.add(Builder::source, SourceField._DESERIALIZER, "_source");
op.add(Builder::runtime, JsonpDeserializer.stringMapDeserializer(RuntimeField._DESERIALIZER), "runtime");
op.add(Builder::enabled, JsonpDeserializer.booleanDeserializer(), "enabled");
op.add(Builder::subobjects, JsonpDeserializer.booleanDeserializer(), "subobjects");
op.add(Builder::dataStreamTimestamp, DataStreamTimestamp._DESERIALIZER, "_data_stream_timestamp");

}
Expand Down
Loading

0 comments on commit f3751c6

Please sign in to comment.