30
30
* GitHub history for details.
31
31
*/
32
32
33
+ //----------------------------------------------------
34
+ // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
35
+ //----------------------------------------------------
36
+
33
37
package org .opensearch .client .opensearch ._types ;
34
38
35
39
import jakarta .json .stream .JsonGenerator ;
36
40
import java .util .List ;
37
41
import java .util .Map ;
42
+ import javax .annotation .Generated ;
38
43
import javax .annotation .Nullable ;
39
44
import org .opensearch .client .json .JsonpDeserializer ;
40
45
import org .opensearch .client .json .JsonpMapper ;
43
48
import org .opensearch .client .util .ApiTypeHelper ;
44
49
import org .opensearch .client .util .ObjectBuilderBase ;
45
50
46
- // typedef: _spec_utils .BaseNode
51
+ // typedef: _types .BaseNode
47
52
53
+ @ Generated ("org.opensearch.client.codegen.CodeGenerator" )
48
54
public abstract class BaseNode implements PlainJsonSerializable {
55
+
49
56
private final Map <String , String > attributes ;
50
57
58
+ @ Nullable
51
59
private final String host ;
52
60
61
+ @ Nullable
53
62
private final String ip ;
54
63
55
64
private final String name ;
56
65
57
66
private final List <NodeRole > roles ;
58
67
68
+ @ Nullable
59
69
private final String transportAddress ;
60
70
61
71
// ---------------------------------------------------------------------------------------------
62
72
63
73
protected BaseNode (AbstractBuilder <?> builder ) {
64
-
65
74
this .attributes = ApiTypeHelper .unmodifiable (builder .attributes );
66
75
this .host = builder .host ;
67
76
this .ip = builder .ip ;
68
- this .name = builder .name ;
77
+ this .name = ApiTypeHelper . requireNonNull ( builder .name , this , "name" ) ;
69
78
this .roles = ApiTypeHelper .unmodifiable (builder .roles );
70
79
this .transportAddress = builder .transportAddress ;
71
-
72
80
}
73
81
74
82
/**
@@ -81,19 +89,21 @@ public final Map<String, String> attributes() {
81
89
/**
82
90
* API name: {@code host}
83
91
*/
92
+ @ Nullable
84
93
public final String host () {
85
94
return this .host ;
86
95
}
87
96
88
97
/**
89
98
* API name: {@code ip}
90
99
*/
100
+ @ Nullable
91
101
public final String ip () {
92
102
return this .ip ;
93
103
}
94
104
95
105
/**
96
- * API name: {@code name}
106
+ * Required - API name: {@code name}
97
107
*/
98
108
public final String name () {
99
109
return this .name ;
@@ -109,37 +119,41 @@ public final List<NodeRole> roles() {
109
119
/**
110
120
* API name: {@code transport_address}
111
121
*/
122
+ @ Nullable
112
123
public final String transportAddress () {
113
124
return this .transportAddress ;
114
125
}
115
126
116
127
/**
117
128
* Serialize this object to JSON.
118
129
*/
130
+ @ Override
119
131
public void serialize (JsonGenerator generator , JsonpMapper mapper ) {
120
132
generator .writeStartObject ();
121
133
serializeInternal (generator , mapper );
122
134
generator .writeEnd ();
123
135
}
124
136
125
137
protected void serializeInternal (JsonGenerator generator , JsonpMapper mapper ) {
126
-
127
138
if (ApiTypeHelper .isDefined (this .attributes )) {
128
139
generator .writeKey ("attributes" );
129
140
generator .writeStartObject ();
130
141
for (Map .Entry <String , String > item0 : this .attributes .entrySet ()) {
131
142
generator .writeKey (item0 .getKey ());
132
143
generator .write (item0 .getValue ());
133
-
134
144
}
135
145
generator .writeEnd ();
146
+ }
136
147
148
+ if (this .host != null ) {
149
+ generator .writeKey ("host" );
150
+ generator .write (this .host );
137
151
}
138
- generator .writeKey ("host" );
139
- generator .write (this .host );
140
152
141
- generator .writeKey ("ip" );
142
- generator .write (this .ip );
153
+ if (this .ip != null ) {
154
+ generator .writeKey ("ip" );
155
+ generator .write (this .ip );
156
+ }
143
157
144
158
generator .writeKey ("name" );
145
159
generator .write (this .name );
@@ -151,36 +165,35 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
151
165
item0 .serialize (generator , mapper );
152
166
}
153
167
generator .writeEnd ();
154
-
155
168
}
156
- generator .writeKey ("transport_address" );
157
- generator .write (this .transportAddress );
158
169
170
+ if (this .transportAddress != null ) {
171
+ generator .writeKey ("transport_address" );
172
+ generator .write (this .transportAddress );
173
+ }
159
174
}
160
175
176
+ // ---------------------------------------------------------------------------------------------
177
+
161
178
protected abstract static class AbstractBuilder <BuilderT extends AbstractBuilder <BuilderT >> extends ObjectBuilderBase {
162
179
@ Nullable
163
180
private Map <String , String > attributes ;
164
-
165
181
@ Nullable
166
182
private String host ;
167
-
168
183
@ Nullable
169
184
private String ip ;
170
-
171
- @ Nullable
172
185
private String name ;
173
-
174
186
@ Nullable
175
187
private List <NodeRole > roles ;
176
-
177
188
@ Nullable
178
189
private String transportAddress ;
179
190
180
191
/**
181
192
* API name: {@code attributes}
193
+ *
182
194
* <p>
183
- * Adds all entries of <code>map</code> to <code>attributes</code>.
195
+ * Adds all elements of <code>map</code> to <code>attributes</code>.
196
+ * </p>
184
197
*/
185
198
public final BuilderT attributes (Map <String , String > map ) {
186
199
this .attributes = _mapPutAll (this .attributes , map );
@@ -189,8 +202,10 @@ public final BuilderT attributes(Map<String, String> map) {
189
202
190
203
/**
191
204
* API name: {@code attributes}
205
+ *
192
206
* <p>
193
207
* Adds an entry to <code>attributes</code>.
208
+ * </p>
194
209
*/
195
210
public final BuilderT attributes (String key , String value ) {
196
211
this .attributes = _mapPut (this .attributes , key , value );
@@ -200,21 +215,21 @@ public final BuilderT attributes(String key, String value) {
200
215
/**
201
216
* API name: {@code host}
202
217
*/
203
- public final BuilderT host (String value ) {
218
+ public final BuilderT host (@ Nullable String value ) {
204
219
this .host = value ;
205
220
return self ();
206
221
}
207
222
208
223
/**
209
224
* API name: {@code ip}
210
225
*/
211
- public final BuilderT ip (String value ) {
226
+ public final BuilderT ip (@ Nullable String value ) {
212
227
this .ip = value ;
213
228
return self ();
214
229
}
215
230
216
231
/**
217
- * API name: {@code name}
232
+ * Required - API name: {@code name}
218
233
*/
219
234
public final BuilderT name (String value ) {
220
235
this .name = value ;
@@ -223,8 +238,10 @@ public final BuilderT name(String value) {
223
238
224
239
/**
225
240
* API name: {@code roles}
241
+ *
226
242
* <p>
227
243
* Adds all elements of <code>list</code> to <code>roles</code>.
244
+ * </p>
228
245
*/
229
246
public final BuilderT roles (List <NodeRole > list ) {
230
247
this .roles = _listAddAll (this .roles , list );
@@ -233,8 +250,10 @@ public final BuilderT roles(List<NodeRole> list) {
233
250
234
251
/**
235
252
* API name: {@code roles}
253
+ *
236
254
* <p>
237
255
* Adds one or more values to <code>roles</code>.
256
+ * </p>
238
257
*/
239
258
public final BuilderT roles (NodeRole value , NodeRole ... values ) {
240
259
this .roles = _listAdd (this .roles , value , values );
@@ -244,25 +263,22 @@ public final BuilderT roles(NodeRole value, NodeRole... values) {
244
263
/**
245
264
* API name: {@code transport_address}
246
265
*/
247
- public final BuilderT transportAddress (String value ) {
266
+ public final BuilderT transportAddress (@ Nullable String value ) {
248
267
this .transportAddress = value ;
249
268
return self ();
250
269
}
251
270
252
271
protected abstract BuilderT self ();
253
-
254
272
}
255
273
256
274
// ---------------------------------------------------------------------------------------------
257
- protected static <BuilderT extends AbstractBuilder <BuilderT >> void setupBaseNodeDeserializer (ObjectDeserializer <BuilderT > op ) {
258
275
276
+ protected static <BuilderT extends AbstractBuilder <BuilderT >> void setupBaseNodeDeserializer (ObjectDeserializer <BuilderT > op ) {
259
277
op .add (AbstractBuilder ::attributes , JsonpDeserializer .stringMapDeserializer (JsonpDeserializer .stringDeserializer ()), "attributes" );
260
278
op .add (AbstractBuilder ::host , JsonpDeserializer .stringDeserializer (), "host" );
261
279
op .add (AbstractBuilder ::ip , JsonpDeserializer .stringDeserializer (), "ip" );
262
280
op .add (AbstractBuilder ::name , JsonpDeserializer .stringDeserializer (), "name" );
263
281
op .add (AbstractBuilder ::roles , JsonpDeserializer .arrayDeserializer (NodeRole ._DESERIALIZER ), "roles" );
264
282
op .add (AbstractBuilder ::transportAddress , JsonpDeserializer .stringDeserializer (), "transport_address" );
265
-
266
283
}
267
-
268
284
}
0 commit comments