|
| 1 | +/* |
| 2 | + * SPDX-License-Identifier: Apache-2.0 |
| 3 | + * |
| 4 | + * The OpenSearch Contributors require contributions made to |
| 5 | + * this file be licensed under the Apache-2.0 license or a |
| 6 | + * compatible open source license. |
| 7 | + */ |
| 8 | + |
| 9 | +/* |
| 10 | + * Licensed to Elasticsearch B.V. under one or more contributor |
| 11 | + * license agreements. See the NOTICE file distributed with |
| 12 | + * this work for additional information regarding copyright |
| 13 | + * ownership. Elasticsearch B.V. licenses this file to you under |
| 14 | + * the Apache License, Version 2.0 (the "License"); you may |
| 15 | + * not use this file except in compliance with the License. |
| 16 | + * You may obtain a copy of the License at |
| 17 | + * |
| 18 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 19 | + * |
| 20 | + * Unless required by applicable law or agreed to in writing, |
| 21 | + * software distributed under the License is distributed on an |
| 22 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 23 | + * KIND, either express or implied. See the License for the |
| 24 | + * specific language governing permissions and limitations |
| 25 | + * under the License. |
| 26 | + */ |
| 27 | + |
| 28 | +/* |
| 29 | + * Modifications Copyright OpenSearch Contributors. See |
| 30 | + * GitHub history for details. |
| 31 | + */ |
| 32 | + |
| 33 | +//---------------------------------------------------- |
| 34 | +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. |
| 35 | +//---------------------------------------------------- |
| 36 | + |
| 37 | +package org.opensearch.client.opensearch._types; |
| 38 | + |
| 39 | +import jakarta.json.stream.JsonGenerator; |
| 40 | +import java.util.function.Function; |
| 41 | +import javax.annotation.Generated; |
| 42 | +import javax.annotation.Nonnull; |
| 43 | +import org.opensearch.client.json.JsonpDeserializable; |
| 44 | +import org.opensearch.client.json.JsonpDeserializer; |
| 45 | +import org.opensearch.client.json.JsonpMapper; |
| 46 | +import org.opensearch.client.json.ObjectBuilderDeserializer; |
| 47 | +import org.opensearch.client.json.ObjectDeserializer; |
| 48 | +import org.opensearch.client.json.PlainJsonSerializable; |
| 49 | +import org.opensearch.client.util.ApiTypeHelper; |
| 50 | +import org.opensearch.client.util.CopyableBuilder; |
| 51 | +import org.opensearch.client.util.ObjectBuilder; |
| 52 | +import org.opensearch.client.util.ObjectBuilderBase; |
| 53 | +import org.opensearch.client.util.ToCopyableBuilder; |
| 54 | + |
| 55 | +// typedef: _types.PhaseTook |
| 56 | + |
| 57 | +@JsonpDeserializable |
| 58 | +@Generated("org.opensearch.client.codegen.CodeGenerator") |
| 59 | +public class PhaseTook implements PlainJsonSerializable, ToCopyableBuilder<PhaseTook.Builder, PhaseTook> { |
| 60 | + |
| 61 | + private final int canMatch; |
| 62 | + |
| 63 | + private final int dfsPreQuery; |
| 64 | + |
| 65 | + private final int dfsQuery; |
| 66 | + |
| 67 | + private final int expand; |
| 68 | + |
| 69 | + private final int fetch; |
| 70 | + |
| 71 | + private final int query; |
| 72 | + |
| 73 | + // --------------------------------------------------------------------------------------------- |
| 74 | + |
| 75 | + private PhaseTook(Builder builder) { |
| 76 | + this.canMatch = ApiTypeHelper.requireNonNull(builder.canMatch, this, "canMatch"); |
| 77 | + this.dfsPreQuery = ApiTypeHelper.requireNonNull(builder.dfsPreQuery, this, "dfsPreQuery"); |
| 78 | + this.dfsQuery = ApiTypeHelper.requireNonNull(builder.dfsQuery, this, "dfsQuery"); |
| 79 | + this.expand = ApiTypeHelper.requireNonNull(builder.expand, this, "expand"); |
| 80 | + this.fetch = ApiTypeHelper.requireNonNull(builder.fetch, this, "fetch"); |
| 81 | + this.query = ApiTypeHelper.requireNonNull(builder.query, this, "query"); |
| 82 | + } |
| 83 | + |
| 84 | + public static PhaseTook of(Function<PhaseTook.Builder, ObjectBuilder<PhaseTook>> fn) { |
| 85 | + return fn.apply(new Builder()).build(); |
| 86 | + } |
| 87 | + |
| 88 | + /** |
| 89 | + * Required - API name: {@code can_match} |
| 90 | + */ |
| 91 | + public final int canMatch() { |
| 92 | + return this.canMatch; |
| 93 | + } |
| 94 | + |
| 95 | + /** |
| 96 | + * Required - API name: {@code dfs_pre_query} |
| 97 | + */ |
| 98 | + public final int dfsPreQuery() { |
| 99 | + return this.dfsPreQuery; |
| 100 | + } |
| 101 | + |
| 102 | + /** |
| 103 | + * Required - API name: {@code dfs_query} |
| 104 | + */ |
| 105 | + public final int dfsQuery() { |
| 106 | + return this.dfsQuery; |
| 107 | + } |
| 108 | + |
| 109 | + /** |
| 110 | + * Required - API name: {@code expand} |
| 111 | + */ |
| 112 | + public final int expand() { |
| 113 | + return this.expand; |
| 114 | + } |
| 115 | + |
| 116 | + /** |
| 117 | + * Required - API name: {@code fetch} |
| 118 | + */ |
| 119 | + public final int fetch() { |
| 120 | + return this.fetch; |
| 121 | + } |
| 122 | + |
| 123 | + /** |
| 124 | + * Required - API name: {@code query} |
| 125 | + */ |
| 126 | + public final int query() { |
| 127 | + return this.query; |
| 128 | + } |
| 129 | + |
| 130 | + /** |
| 131 | + * Serialize this object to JSON. |
| 132 | + */ |
| 133 | + @Override |
| 134 | + public void serialize(JsonGenerator generator, JsonpMapper mapper) { |
| 135 | + generator.writeStartObject(); |
| 136 | + serializeInternal(generator, mapper); |
| 137 | + generator.writeEnd(); |
| 138 | + } |
| 139 | + |
| 140 | + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { |
| 141 | + generator.writeKey("can_match"); |
| 142 | + generator.write(this.canMatch); |
| 143 | + |
| 144 | + generator.writeKey("dfs_pre_query"); |
| 145 | + generator.write(this.dfsPreQuery); |
| 146 | + |
| 147 | + generator.writeKey("dfs_query"); |
| 148 | + generator.write(this.dfsQuery); |
| 149 | + |
| 150 | + generator.writeKey("expand"); |
| 151 | + generator.write(this.expand); |
| 152 | + |
| 153 | + generator.writeKey("fetch"); |
| 154 | + generator.write(this.fetch); |
| 155 | + |
| 156 | + generator.writeKey("query"); |
| 157 | + generator.write(this.query); |
| 158 | + } |
| 159 | + |
| 160 | + // --------------------------------------------------------------------------------------------- |
| 161 | + |
| 162 | + @Override |
| 163 | + @Nonnull |
| 164 | + public Builder toBuilder() { |
| 165 | + return new Builder(this); |
| 166 | + } |
| 167 | + |
| 168 | + @Nonnull |
| 169 | + public static Builder builder() { |
| 170 | + return new Builder(); |
| 171 | + } |
| 172 | + |
| 173 | + /** |
| 174 | + * Builder for {@link PhaseTook}. |
| 175 | + */ |
| 176 | + public static class Builder extends ObjectBuilderBase implements CopyableBuilder<Builder, PhaseTook> { |
| 177 | + private Integer canMatch; |
| 178 | + private Integer dfsPreQuery; |
| 179 | + private Integer dfsQuery; |
| 180 | + private Integer expand; |
| 181 | + private Integer fetch; |
| 182 | + private Integer query; |
| 183 | + |
| 184 | + public Builder() {} |
| 185 | + |
| 186 | + private Builder(PhaseTook o) { |
| 187 | + this.canMatch = o.canMatch; |
| 188 | + this.dfsPreQuery = o.dfsPreQuery; |
| 189 | + this.dfsQuery = o.dfsQuery; |
| 190 | + this.expand = o.expand; |
| 191 | + this.fetch = o.fetch; |
| 192 | + this.query = o.query; |
| 193 | + } |
| 194 | + |
| 195 | + private Builder(Builder o) { |
| 196 | + this.canMatch = o.canMatch; |
| 197 | + this.dfsPreQuery = o.dfsPreQuery; |
| 198 | + this.dfsQuery = o.dfsQuery; |
| 199 | + this.expand = o.expand; |
| 200 | + this.fetch = o.fetch; |
| 201 | + this.query = o.query; |
| 202 | + } |
| 203 | + |
| 204 | + @Override |
| 205 | + @Nonnull |
| 206 | + public Builder copy() { |
| 207 | + return new Builder(this); |
| 208 | + } |
| 209 | + |
| 210 | + /** |
| 211 | + * Required - API name: {@code can_match} |
| 212 | + */ |
| 213 | + @Nonnull |
| 214 | + public final Builder canMatch(int value) { |
| 215 | + this.canMatch = value; |
| 216 | + return this; |
| 217 | + } |
| 218 | + |
| 219 | + /** |
| 220 | + * Required - API name: {@code dfs_pre_query} |
| 221 | + */ |
| 222 | + @Nonnull |
| 223 | + public final Builder dfsPreQuery(int value) { |
| 224 | + this.dfsPreQuery = value; |
| 225 | + return this; |
| 226 | + } |
| 227 | + |
| 228 | + /** |
| 229 | + * Required - API name: {@code dfs_query} |
| 230 | + */ |
| 231 | + @Nonnull |
| 232 | + public final Builder dfsQuery(int value) { |
| 233 | + this.dfsQuery = value; |
| 234 | + return this; |
| 235 | + } |
| 236 | + |
| 237 | + /** |
| 238 | + * Required - API name: {@code expand} |
| 239 | + */ |
| 240 | + @Nonnull |
| 241 | + public final Builder expand(int value) { |
| 242 | + this.expand = value; |
| 243 | + return this; |
| 244 | + } |
| 245 | + |
| 246 | + /** |
| 247 | + * Required - API name: {@code fetch} |
| 248 | + */ |
| 249 | + @Nonnull |
| 250 | + public final Builder fetch(int value) { |
| 251 | + this.fetch = value; |
| 252 | + return this; |
| 253 | + } |
| 254 | + |
| 255 | + /** |
| 256 | + * Required - API name: {@code query} |
| 257 | + */ |
| 258 | + @Nonnull |
| 259 | + public final Builder query(int value) { |
| 260 | + this.query = value; |
| 261 | + return this; |
| 262 | + } |
| 263 | + |
| 264 | + /** |
| 265 | + * Builds a {@link PhaseTook}. |
| 266 | + * |
| 267 | + * @throws NullPointerException if some of the required fields are null. |
| 268 | + */ |
| 269 | + @Override |
| 270 | + @Nonnull |
| 271 | + public PhaseTook build() { |
| 272 | + _checkSingleUse(); |
| 273 | + |
| 274 | + return new PhaseTook(this); |
| 275 | + } |
| 276 | + } |
| 277 | + |
| 278 | + // --------------------------------------------------------------------------------------------- |
| 279 | + |
| 280 | + /** |
| 281 | + * Json deserializer for {@link PhaseTook} |
| 282 | + */ |
| 283 | + public static final JsonpDeserializer<PhaseTook> _DESERIALIZER = ObjectBuilderDeserializer.lazy( |
| 284 | + Builder::new, |
| 285 | + PhaseTook::setupPhaseTookDeserializer |
| 286 | + ); |
| 287 | + |
| 288 | + protected static void setupPhaseTookDeserializer(ObjectDeserializer<PhaseTook.Builder> op) { |
| 289 | + op.add(Builder::canMatch, JsonpDeserializer.integerDeserializer(), "can_match"); |
| 290 | + op.add(Builder::dfsPreQuery, JsonpDeserializer.integerDeserializer(), "dfs_pre_query"); |
| 291 | + op.add(Builder::dfsQuery, JsonpDeserializer.integerDeserializer(), "dfs_query"); |
| 292 | + op.add(Builder::expand, JsonpDeserializer.integerDeserializer(), "expand"); |
| 293 | + op.add(Builder::fetch, JsonpDeserializer.integerDeserializer(), "fetch"); |
| 294 | + op.add(Builder::query, JsonpDeserializer.integerDeserializer(), "query"); |
| 295 | + } |
| 296 | + |
| 297 | + @Override |
| 298 | + public int hashCode() { |
| 299 | + int result = 17; |
| 300 | + result = 31 * result + Integer.hashCode(this.canMatch); |
| 301 | + result = 31 * result + Integer.hashCode(this.dfsPreQuery); |
| 302 | + result = 31 * result + Integer.hashCode(this.dfsQuery); |
| 303 | + result = 31 * result + Integer.hashCode(this.expand); |
| 304 | + result = 31 * result + Integer.hashCode(this.fetch); |
| 305 | + result = 31 * result + Integer.hashCode(this.query); |
| 306 | + return result; |
| 307 | + } |
| 308 | + |
| 309 | + @Override |
| 310 | + public boolean equals(Object o) { |
| 311 | + if (this == o) return true; |
| 312 | + if (o == null || this.getClass() != o.getClass()) return false; |
| 313 | + PhaseTook other = (PhaseTook) o; |
| 314 | + return this.canMatch == other.canMatch |
| 315 | + && this.dfsPreQuery == other.dfsPreQuery |
| 316 | + && this.dfsQuery == other.dfsQuery |
| 317 | + && this.expand == other.expand |
| 318 | + && this.fetch == other.fetch |
| 319 | + && this.query == other.query; |
| 320 | + } |
| 321 | +} |
0 commit comments