All Downloads are FREE. Search and download functionalities are using the official Maven repository.

co.elastic.clients.elasticsearch.xpack.usage.EqlFeaturesJoin Maven / Gradle / Ivy

There is a newer version: 8.17.0
Show newest version
/*
 * Licensed to Elasticsearch B.V. under one or more contributor
 * license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright
 * ownership. Elasticsearch B.V. licenses this file to you under
 * the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

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

package co.elastic.clients.elasticsearch.xpack.usage;

import co.elastic.clients.json.JsonpDeserializable;
import co.elastic.clients.json.JsonpDeserializer;
import co.elastic.clients.json.JsonpMapper;
import co.elastic.clients.json.JsonpSerializable;
import co.elastic.clients.json.ObjectBuilderDeserializer;
import co.elastic.clients.json.ObjectDeserializer;
import co.elastic.clients.util.ApiTypeHelper;
import co.elastic.clients.util.ObjectBuilder;
import co.elastic.clients.util.WithJsonObjectBuilderBase;
import jakarta.json.stream.JsonGenerator;
import java.lang.Number;
import java.util.Objects;
import java.util.function.Function;
import javax.annotation.Nullable;

// typedef: xpack.usage.EqlFeaturesJoin

/**
 *
 * @see API
 *      specification
 */
@JsonpDeserializable
public class EqlFeaturesJoin implements JsonpSerializable {
	private final Number joinQueriesTwo;

	private final Number joinQueriesThree;

	private final Number joinUntil;

	private final Number joinQueriesFiveOrMore;

	private final Number joinQueriesFour;

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

	private EqlFeaturesJoin(Builder builder) {

		this.joinQueriesTwo = ApiTypeHelper.requireNonNull(builder.joinQueriesTwo, this, "joinQueriesTwo");
		this.joinQueriesThree = ApiTypeHelper.requireNonNull(builder.joinQueriesThree, this, "joinQueriesThree");
		this.joinUntil = ApiTypeHelper.requireNonNull(builder.joinUntil, this, "joinUntil");
		this.joinQueriesFiveOrMore = ApiTypeHelper.requireNonNull(builder.joinQueriesFiveOrMore, this,
				"joinQueriesFiveOrMore");
		this.joinQueriesFour = ApiTypeHelper.requireNonNull(builder.joinQueriesFour, this, "joinQueriesFour");

	}

	public static EqlFeaturesJoin of(Function> fn) {
		return fn.apply(new Builder()).build();
	}

	/**
	 * Required - API name: {@code join_queries_two}
	 */
	public final Number joinQueriesTwo() {
		return this.joinQueriesTwo;
	}

	/**
	 * Required - API name: {@code join_queries_three}
	 */
	public final Number joinQueriesThree() {
		return this.joinQueriesThree;
	}

	/**
	 * Required - API name: {@code join_until}
	 */
	public final Number joinUntil() {
		return this.joinUntil;
	}

	/**
	 * Required - API name: {@code join_queries_five_or_more}
	 */
	public final Number joinQueriesFiveOrMore() {
		return this.joinQueriesFiveOrMore;
	}

	/**
	 * Required - API name: {@code join_queries_four}
	 */
	public final Number joinQueriesFour() {
		return this.joinQueriesFour;
	}

	/**
	 * Serialize this object to JSON.
	 */
	public void serialize(JsonGenerator generator, JsonpMapper mapper) {
		generator.writeStartObject();
		serializeInternal(generator, mapper);
		generator.writeEnd();
	}

	protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

		generator.writeKey("join_queries_two");
		generator.write(this.joinQueriesTwo.doubleValue());

		generator.writeKey("join_queries_three");
		generator.write(this.joinQueriesThree.doubleValue());

		generator.writeKey("join_until");
		generator.write(this.joinUntil.doubleValue());

		generator.writeKey("join_queries_five_or_more");
		generator.write(this.joinQueriesFiveOrMore.doubleValue());

		generator.writeKey("join_queries_four");
		generator.write(this.joinQueriesFour.doubleValue());

	}

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

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

	public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder {
		private Number joinQueriesTwo;

		private Number joinQueriesThree;

		private Number joinUntil;

		private Number joinQueriesFiveOrMore;

		private Number joinQueriesFour;

		/**
		 * Required - API name: {@code join_queries_two}
		 */
		public final Builder joinQueriesTwo(Number value) {
			this.joinQueriesTwo = value;
			return this;
		}

		/**
		 * Required - API name: {@code join_queries_three}
		 */
		public final Builder joinQueriesThree(Number value) {
			this.joinQueriesThree = value;
			return this;
		}

		/**
		 * Required - API name: {@code join_until}
		 */
		public final Builder joinUntil(Number value) {
			this.joinUntil = value;
			return this;
		}

		/**
		 * Required - API name: {@code join_queries_five_or_more}
		 */
		public final Builder joinQueriesFiveOrMore(Number value) {
			this.joinQueriesFiveOrMore = value;
			return this;
		}

		/**
		 * Required - API name: {@code join_queries_four}
		 */
		public final Builder joinQueriesFour(Number value) {
			this.joinQueriesFour = value;
			return this;
		}

		@Override
		protected Builder self() {
			return this;
		}

		/**
		 * Builds a {@link EqlFeaturesJoin}.
		 *
		 * @throws NullPointerException
		 *             if some of the required fields are null.
		 */
		public EqlFeaturesJoin build() {
			_checkSingleUse();

			return new EqlFeaturesJoin(this);
		}
	}

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

	/**
	 * Json deserializer for {@link EqlFeaturesJoin}
	 */
	public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new,
			EqlFeaturesJoin::setupEqlFeaturesJoinDeserializer);

	protected static void setupEqlFeaturesJoinDeserializer(ObjectDeserializer op) {

		op.add(Builder::joinQueriesTwo, JsonpDeserializer.numberDeserializer(), "join_queries_two");
		op.add(Builder::joinQueriesThree, JsonpDeserializer.numberDeserializer(), "join_queries_three");
		op.add(Builder::joinUntil, JsonpDeserializer.numberDeserializer(), "join_until");
		op.add(Builder::joinQueriesFiveOrMore, JsonpDeserializer.numberDeserializer(), "join_queries_five_or_more");
		op.add(Builder::joinQueriesFour, JsonpDeserializer.numberDeserializer(), "join_queries_four");

	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy