-
Notifications
You must be signed in to change notification settings - Fork 224
/
ScoreSort.java
164 lines (134 loc) · 4.45 KB
/
ScoreSort.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/*
* 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.
*/
package co.elastic.clients.elasticsearch._types;
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.JsonpUtils;
import co.elastic.clients.json.ObjectBuilderDeserializer;
import co.elastic.clients.json.ObjectDeserializer;
import co.elastic.clients.util.ObjectBuilder;
import co.elastic.clients.util.WithJsonObjectBuilderBase;
import jakarta.json.stream.JsonGenerator;
import java.util.Objects;
import java.util.function.Function;
import javax.annotation.Nullable;
//----------------------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------------------
//
// This code is generated from the Elasticsearch API specification
// at https://github.com/elastic/elasticsearch-specification
//
// Manual updates to this file will be lost when the code is
// re-generated.
//
// If you find a property that is missing or wrongly typed, please
// open an issue or a PR on the API specification repository.
//
//----------------------------------------------------------------
// typedef: _types.ScoreSort
/**
*
* @see <a href="../doc-files/api-spec.html#_types.ScoreSort">API
* specification</a>
*/
@JsonpDeserializable
public class ScoreSort implements SortOptionsVariant, JsonpSerializable {
@Nullable
private final SortOrder order;
// ---------------------------------------------------------------------------------------------
private ScoreSort(Builder builder) {
this.order = builder.order;
}
public static ScoreSort of(Function<Builder, ObjectBuilder<ScoreSort>> fn) {
return fn.apply(new Builder()).build();
}
/**
* SortOptions variant kind.
*/
@Override
public SortOptions.Kind _sortOptionsKind() {
return SortOptions.Kind.Doc;
}
/**
* API name: {@code order}
*/
@Nullable
public final SortOrder order() {
return this.order;
}
/**
* 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) {
if (this.order != null) {
generator.writeKey("order");
this.order.serialize(generator, mapper);
}
}
@Override
public String toString() {
return JsonpUtils.toString(this);
}
// ---------------------------------------------------------------------------------------------
/**
* Builder for {@link ScoreSort}.
*/
public static class Builder extends WithJsonObjectBuilderBase<Builder> implements ObjectBuilder<ScoreSort> {
@Nullable
private SortOrder order;
/**
* API name: {@code order}
*/
public final Builder order(@Nullable SortOrder value) {
this.order = value;
return this;
}
@Override
protected Builder self() {
return this;
}
/**
* Builds a {@link ScoreSort}.
*
* @throws NullPointerException
* if some of the required fields are null.
*/
public ScoreSort build() {
_checkSingleUse();
return new ScoreSort(this);
}
}
// ---------------------------------------------------------------------------------------------
/**
* Json deserializer for {@link ScoreSort}
*/
public static final JsonpDeserializer<ScoreSort> _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new,
ScoreSort::setupScoreSortDeserializer);
protected static void setupScoreSortDeserializer(ObjectDeserializer<ScoreSort.Builder> op) {
op.add(Builder::order, SortOrder._DESERIALIZER, "order");
}
}