63
63
*/
64
64
@ JsonpDeserializable
65
65
public class IndicesPrivileges implements JsonpSerializable {
66
- private final List <FieldSecurity > fieldSecurity ;
66
+ @ Nullable
67
+ private final FieldSecurity fieldSecurity ;
67
68
68
69
private final List <String > names ;
69
70
@@ -79,7 +80,7 @@ public class IndicesPrivileges implements JsonpSerializable {
79
80
80
81
private IndicesPrivileges (Builder builder ) {
81
82
82
- this .fieldSecurity = ApiTypeHelper . unmodifiable ( builder .fieldSecurity ) ;
83
+ this .fieldSecurity = builder .fieldSecurity ;
83
84
this .names = ApiTypeHelper .unmodifiableRequired (builder .names , this , "names" );
84
85
this .privileges = ApiTypeHelper .unmodifiableRequired (builder .privileges , this , "privileges" );
85
86
this .query = builder .query ;
@@ -96,7 +97,8 @@ public static IndicesPrivileges of(Function<Builder, ObjectBuilder<IndicesPrivil
96
97
* <p>
97
98
* API name: {@code field_security}
98
99
*/
99
- public final List <FieldSecurity > fieldSecurity () {
100
+ @ Nullable
101
+ public final FieldSecurity fieldSecurity () {
100
102
return this .fieldSecurity ;
101
103
}
102
104
@@ -160,14 +162,9 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
160
162
161
163
protected void serializeInternal (JsonGenerator generator , JsonpMapper mapper ) {
162
164
163
- if (ApiTypeHelper . isDefined ( this .fieldSecurity ) ) {
165
+ if (this .fieldSecurity != null ) {
164
166
generator .writeKey ("field_security" );
165
- generator .writeStartArray ();
166
- for (FieldSecurity item0 : this .fieldSecurity ) {
167
- item0 .serialize (generator , mapper );
168
-
169
- }
170
- generator .writeEnd ();
167
+ this .fieldSecurity .serialize (generator , mapper );
171
168
172
169
}
173
170
if (ApiTypeHelper .isDefined (this .names )) {
@@ -216,7 +213,7 @@ public String toString() {
216
213
217
214
public static class Builder extends WithJsonObjectBuilderBase <Builder > implements ObjectBuilder <IndicesPrivileges > {
218
215
@ Nullable
219
- private List < FieldSecurity > fieldSecurity ;
216
+ private FieldSecurity fieldSecurity ;
220
217
221
218
private List <String > names ;
222
219
@@ -232,35 +229,19 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder> implement
232
229
* The document fields that the owners of the role have read access to.
233
230
* <p>
234
231
* API name: {@code field_security}
235
- * <p>
236
- * Adds all elements of <code>list</code> to <code>fieldSecurity</code>.
237
232
*/
238
- public final Builder fieldSecurity (List < FieldSecurity > list ) {
239
- this .fieldSecurity = _listAddAll ( this . fieldSecurity , list ) ;
233
+ public final Builder fieldSecurity (@ Nullable FieldSecurity value ) {
234
+ this .fieldSecurity = value ;
240
235
return this ;
241
236
}
242
237
243
238
/**
244
239
* The document fields that the owners of the role have read access to.
245
240
* <p>
246
241
* API name: {@code field_security}
247
- * <p>
248
- * Adds one or more values to <code>fieldSecurity</code>.
249
- */
250
- public final Builder fieldSecurity (FieldSecurity value , FieldSecurity ... values ) {
251
- this .fieldSecurity = _listAdd (this .fieldSecurity , value , values );
252
- return this ;
253
- }
254
-
255
- /**
256
- * The document fields that the owners of the role have read access to.
257
- * <p>
258
- * API name: {@code field_security}
259
- * <p>
260
- * Adds a value to <code>fieldSecurity</code> using a builder lambda.
261
242
*/
262
243
public final Builder fieldSecurity (Function <FieldSecurity .Builder , ObjectBuilder <FieldSecurity >> fn ) {
263
- return fieldSecurity (fn .apply (new FieldSecurity .Builder ()).build ());
244
+ return this . fieldSecurity (fn .apply (new FieldSecurity .Builder ()).build ());
264
245
}
265
246
266
247
/**
@@ -385,8 +366,7 @@ public IndicesPrivileges build() {
385
366
386
367
protected static void setupIndicesPrivilegesDeserializer (ObjectDeserializer <IndicesPrivileges .Builder > op ) {
387
368
388
- op .add (Builder ::fieldSecurity , JsonpDeserializer .arrayDeserializer (FieldSecurity ._DESERIALIZER ),
389
- "field_security" );
369
+ op .add (Builder ::fieldSecurity , FieldSecurity ._DESERIALIZER , "field_security" );
390
370
op .add (Builder ::names , JsonpDeserializer .arrayDeserializer (JsonpDeserializer .stringDeserializer ()), "names" );
391
371
op .add (Builder ::privileges , JsonpDeserializer .arrayDeserializer (JsonpDeserializer .stringDeserializer ()),
392
372
"privileges" );
0 commit comments