|
19 | 19 |
|
20 | 20 | package co.elastic.clients.elasticsearch.nodes;
|
21 | 21 |
|
22 |
| -import co.elastic.clients.elasticsearch.nodes.hot_threads.HotThread; |
23 | 22 | import co.elastic.clients.json.JsonpDeserializable;
|
24 | 23 | import co.elastic.clients.json.JsonpDeserializer;
|
25 |
| -import co.elastic.clients.json.JsonpMapper; |
26 |
| -import co.elastic.clients.json.JsonpSerializable; |
27 |
| -import co.elastic.clients.json.JsonpUtils; |
28 | 24 | import co.elastic.clients.json.ObjectBuilderDeserializer;
|
29 | 25 | import co.elastic.clients.json.ObjectDeserializer;
|
30 |
| -import co.elastic.clients.util.ApiTypeHelper; |
31 | 26 | import co.elastic.clients.util.ObjectBuilder;
|
32 |
| -import co.elastic.clients.util.WithJsonObjectBuilderBase; |
33 | 27 | import jakarta.json.stream.JsonGenerator;
|
34 |
| -import java.util.List; |
35 | 28 | import java.util.Objects;
|
36 |
| -import java.util.function.Function; |
37 |
| -import javax.annotation.Nullable; |
38 | 29 |
|
39 | 30 | //----------------------------------------------------------------
|
40 | 31 | // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
|
|
58 | 49 | * @see <a href="../doc-files/api-spec.html#nodes.hot_threads.Response">API
|
59 | 50 | * specification</a>
|
60 | 51 | */
|
61 |
| -@JsonpDeserializable |
62 |
| -public class HotThreadsResponse implements JsonpSerializable { |
63 |
| - private final List<HotThread> hotThreads; |
64 | 52 |
|
65 |
| - // --------------------------------------------------------------------------------------------- |
66 |
| - |
67 |
| - private HotThreadsResponse(Builder builder) { |
68 |
| - |
69 |
| - this.hotThreads = ApiTypeHelper.unmodifiableRequired(builder.hotThreads, this, "hotThreads"); |
70 |
| - |
71 |
| - } |
72 |
| - |
73 |
| - public static HotThreadsResponse of(Function<Builder, ObjectBuilder<HotThreadsResponse>> fn) { |
74 |
| - return fn.apply(new Builder()).build(); |
| 53 | +public class HotThreadsResponse { |
| 54 | + public HotThreadsResponse() { |
75 | 55 | }
|
76 | 56 |
|
77 | 57 | /**
|
78 |
| - * Required - API name: {@code hot_threads} |
| 58 | + * Singleton instance for {@link HotThreadsResponse}. |
79 | 59 | */
|
80 |
| - public final List<HotThread> hotThreads() { |
81 |
| - return this.hotThreads; |
82 |
| - } |
83 |
| - |
84 |
| - /** |
85 |
| - * Serialize this object to JSON. |
86 |
| - */ |
87 |
| - public void serialize(JsonGenerator generator, JsonpMapper mapper) { |
88 |
| - generator.writeStartObject(); |
89 |
| - serializeInternal(generator, mapper); |
90 |
| - generator.writeEnd(); |
91 |
| - } |
92 |
| - |
93 |
| - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { |
94 |
| - |
95 |
| - if (ApiTypeHelper.isDefined(this.hotThreads)) { |
96 |
| - generator.writeKey("hot_threads"); |
97 |
| - generator.writeStartArray(); |
98 |
| - for (HotThread item0 : this.hotThreads) { |
99 |
| - item0.serialize(generator, mapper); |
100 |
| - |
101 |
| - } |
102 |
| - generator.writeEnd(); |
103 |
| - |
104 |
| - } |
105 |
| - |
106 |
| - } |
107 |
| - |
108 |
| - @Override |
109 |
| - public String toString() { |
110 |
| - return JsonpUtils.toString(this); |
111 |
| - } |
112 |
| - |
113 |
| - // --------------------------------------------------------------------------------------------- |
| 60 | + public static final HotThreadsResponse _INSTANCE = new HotThreadsResponse(); |
114 | 61 |
|
115 |
| - /** |
116 |
| - * Builder for {@link HotThreadsResponse}. |
117 |
| - */ |
118 |
| - |
119 |
| - public static class Builder extends WithJsonObjectBuilderBase<Builder> |
120 |
| - implements |
121 |
| - ObjectBuilder<HotThreadsResponse> { |
122 |
| - private List<HotThread> hotThreads; |
123 |
| - |
124 |
| - /** |
125 |
| - * Required - API name: {@code hot_threads} |
126 |
| - * <p> |
127 |
| - * Adds all elements of <code>list</code> to <code>hotThreads</code>. |
128 |
| - */ |
129 |
| - public final Builder hotThreads(List<HotThread> list) { |
130 |
| - this.hotThreads = _listAddAll(this.hotThreads, list); |
131 |
| - return this; |
132 |
| - } |
133 |
| - |
134 |
| - /** |
135 |
| - * Required - API name: {@code hot_threads} |
136 |
| - * <p> |
137 |
| - * Adds one or more values to <code>hotThreads</code>. |
138 |
| - */ |
139 |
| - public final Builder hotThreads(HotThread value, HotThread... values) { |
140 |
| - this.hotThreads = _listAdd(this.hotThreads, value, values); |
141 |
| - return this; |
142 |
| - } |
143 |
| - |
144 |
| - /** |
145 |
| - * Required - API name: {@code hot_threads} |
146 |
| - * <p> |
147 |
| - * Adds a value to <code>hotThreads</code> using a builder lambda. |
148 |
| - */ |
149 |
| - public final Builder hotThreads(Function<HotThread.Builder, ObjectBuilder<HotThread>> fn) { |
150 |
| - return hotThreads(fn.apply(new HotThread.Builder()).build()); |
151 |
| - } |
152 |
| - |
153 |
| - @Override |
154 |
| - protected Builder self() { |
155 |
| - return this; |
156 |
| - } |
157 |
| - |
158 |
| - /** |
159 |
| - * Builds a {@link HotThreadsResponse}. |
160 |
| - * |
161 |
| - * @throws NullPointerException |
162 |
| - * if some of the required fields are null. |
163 |
| - */ |
164 |
| - public HotThreadsResponse build() { |
165 |
| - _checkSingleUse(); |
166 |
| - |
167 |
| - return new HotThreadsResponse(this); |
168 |
| - } |
169 |
| - } |
170 |
| - |
171 |
| - // --------------------------------------------------------------------------------------------- |
172 |
| - |
173 |
| - /** |
174 |
| - * Json deserializer for {@link HotThreadsResponse} |
175 |
| - */ |
176 |
| - public static final JsonpDeserializer<HotThreadsResponse> _DESERIALIZER = ObjectBuilderDeserializer |
177 |
| - .lazy(Builder::new, HotThreadsResponse::setupHotThreadsResponseDeserializer); |
178 |
| - |
179 |
| - protected static void setupHotThreadsResponseDeserializer(ObjectDeserializer<HotThreadsResponse.Builder> op) { |
180 |
| - |
181 |
| - op.add(Builder::hotThreads, JsonpDeserializer.arrayDeserializer(HotThread._DESERIALIZER), "hot_threads"); |
182 |
| - |
183 |
| - } |
| 62 | + public static final JsonpDeserializer<HotThreadsResponse> _DESERIALIZER = JsonpDeserializer |
| 63 | + .emptyObject(HotThreadsResponse._INSTANCE); |
184 | 64 |
|
185 | 65 | }
|
0 commit comments