@@ -105,8 +105,8 @@ public Iterator<JsonNode> elements() {
105
105
public JsonNode get (int index ) { return null ; }
106
106
107
107
@ Override
108
- public JsonNode get (String fieldName ) {
109
- return _children .get (fieldName );
108
+ public JsonNode get (String propertyName ) {
109
+ return _children .get (propertyName );
110
110
}
111
111
112
112
@ Override
@@ -120,26 +120,26 @@ public JsonNode path(int index) {
120
120
}
121
121
122
122
@ Override
123
- public JsonNode path (String fieldName )
123
+ public JsonNode path (String propertyName )
124
124
{
125
- JsonNode n = _children .get (fieldName );
125
+ JsonNode n = _children .get (propertyName );
126
126
if (n != null ) {
127
127
return n ;
128
128
}
129
129
return MissingNode .getInstance ();
130
130
}
131
131
132
132
@ Override
133
- public JsonNode required (String fieldName ) {
134
- JsonNode n = _children .get (fieldName );
133
+ public JsonNode required (String propertyName ) {
134
+ JsonNode n = _children .get (propertyName );
135
135
if (n != null ) {
136
136
return n ;
137
137
}
138
- return _reportRequiredViolation ("No value for property '%s' of `ObjectNode`" , fieldName );
138
+ return _reportRequiredViolation ("No value for property '%s' of `ObjectNode`" , propertyName );
139
139
}
140
140
141
141
/**
142
- * Method to use for accessing all fields (with both names
142
+ * Method to use for accessing all properties (with both names
143
143
* and values) of this JSON Object.
144
144
*/
145
145
@ Override
@@ -213,13 +213,13 @@ public boolean equals(Comparator<JsonNode> comparator, JsonNode o)
213
213
*/
214
214
215
215
@ Override
216
- public JsonNode findValue (String fieldName )
216
+ public JsonNode findValue (String propertyName )
217
217
{
218
218
for (Map .Entry <String , JsonNode > entry : _children .entrySet ()) {
219
- if (fieldName .equals (entry .getKey ())) {
219
+ if (propertyName .equals (entry .getKey ())) {
220
220
return entry .getValue ();
221
221
}
222
- JsonNode value = entry .getValue ().findValue (fieldName );
222
+ JsonNode value = entry .getValue ().findValue (propertyName );
223
223
if (value != null ) {
224
224
return value ;
225
225
}
@@ -228,46 +228,46 @@ public JsonNode findValue(String fieldName)
228
228
}
229
229
230
230
@ Override
231
- public List <JsonNode > findValues (String fieldName , List <JsonNode > foundSoFar )
231
+ public List <JsonNode > findValues (String propertyName , List <JsonNode > foundSoFar )
232
232
{
233
233
for (Map .Entry <String , JsonNode > entry : _children .entrySet ()) {
234
- if (fieldName .equals (entry .getKey ())) {
234
+ if (propertyName .equals (entry .getKey ())) {
235
235
if (foundSoFar == null ) {
236
236
foundSoFar = new ArrayList <JsonNode >();
237
237
}
238
238
foundSoFar .add (entry .getValue ());
239
239
} else { // only add children if parent not added
240
- foundSoFar = entry .getValue ().findValues (fieldName , foundSoFar );
240
+ foundSoFar = entry .getValue ().findValues (propertyName , foundSoFar );
241
241
}
242
242
}
243
243
return foundSoFar ;
244
244
}
245
245
246
246
@ Override
247
- public List <String > findValuesAsText (String fieldName , List <String > foundSoFar )
247
+ public List <String > findValuesAsText (String propertyName , List <String > foundSoFar )
248
248
{
249
249
for (Map .Entry <String , JsonNode > entry : _children .entrySet ()) {
250
- if (fieldName .equals (entry .getKey ())) {
250
+ if (propertyName .equals (entry .getKey ())) {
251
251
if (foundSoFar == null ) {
252
252
foundSoFar = new ArrayList <String >();
253
253
}
254
254
foundSoFar .add (entry .getValue ().asText ());
255
255
} else { // only add children if parent not added
256
- foundSoFar = entry .getValue ().findValuesAsText (fieldName ,
256
+ foundSoFar = entry .getValue ().findValuesAsText (propertyName ,
257
257
foundSoFar );
258
258
}
259
259
}
260
260
return foundSoFar ;
261
261
}
262
262
263
263
@ Override
264
- public ObjectNode findParent (String fieldName )
264
+ public ObjectNode findParent (String propertyName )
265
265
{
266
266
for (Map .Entry <String , JsonNode > entry : _children .entrySet ()) {
267
- if (fieldName .equals (entry .getKey ())) {
267
+ if (propertyName .equals (entry .getKey ())) {
268
268
return this ;
269
269
}
270
- JsonNode value = entry .getValue ().findParent (fieldName );
270
+ JsonNode value = entry .getValue ().findParent (propertyName );
271
271
if (value != null ) {
272
272
return (ObjectNode ) value ;
273
273
}
@@ -276,22 +276,22 @@ public ObjectNode findParent(String fieldName)
276
276
}
277
277
278
278
@ Override
279
- public List <JsonNode > findParents (String fieldName , List <JsonNode > foundSoFar )
279
+ public List <JsonNode > findParents (String propertyName , List <JsonNode > foundSoFar )
280
280
{
281
281
for (Map .Entry <String , JsonNode > entry : _children .entrySet ()) {
282
- if (fieldName .equals (entry .getKey ())) {
282
+ if (propertyName .equals (entry .getKey ())) {
283
283
if (foundSoFar == null ) {
284
284
foundSoFar = new ArrayList <JsonNode >();
285
285
}
286
286
foundSoFar .add (this );
287
287
} else { // only add children if parent not added
288
288
foundSoFar = entry .getValue ()
289
- .findParents (fieldName , foundSoFar );
289
+ .findParents (propertyName , foundSoFar );
290
290
}
291
291
}
292
292
return foundSoFar ;
293
293
}
294
-
294
+
295
295
/*
296
296
/**********************************************************
297
297
/* Public API, serialization
@@ -364,7 +364,7 @@ public void serializeWithType(JsonGenerator g, SerializerProvider provider,
364
364
*/
365
365
366
366
/**
367
- * Method that will set specified field , replacing old value, if any.
367
+ * Method that will set specified property , replacing old value, if any.
368
368
* Note that this is identical to {@link #replace(String, JsonNode)},
369
369
* except for return value.
370
370
*<p>
@@ -440,36 +440,36 @@ public <T extends JsonNode> T setAll(ObjectNode other)
440
440
* Method for replacing value of specific property with passed
441
441
* value, and returning value (or null if none).
442
442
*
443
- * @param fieldName Property of which value to replace
443
+ * @param propertyName Property of which value to replace
444
444
* @param value Value to set property to, replacing old value if any
445
445
*
446
446
* @return Old value of the property; null if there was no such property
447
447
* with value
448
448
*
449
449
* @since 2.1
450
450
*/
451
- public JsonNode replace (String fieldName , JsonNode value )
451
+ public JsonNode replace (String propertyName , JsonNode value )
452
452
{
453
453
if (value == null ) { // let's not store 'raw' nulls but nodes
454
454
value = nullNode ();
455
455
}
456
- return _children .put (fieldName , value );
456
+ return _children .put (propertyName , value );
457
457
}
458
458
459
459
/**
460
- * Method for removing field entry from this ObjectNode, and
460
+ * Method for removing property from this ObjectNode, and
461
461
* returning instance after removal.
462
462
*<p>
463
463
* NOTE: co-variant return type since 2.10
464
464
*
465
- * @return This node after removing entry (if any)
465
+ * @return This node after removing property (if any)
466
466
*
467
467
* @since 2.1
468
468
*/
469
469
@ SuppressWarnings ("unchecked" )
470
- public <T extends JsonNode > T without (String fieldName )
470
+ public <T extends JsonNode > T without (String propertyName )
471
471
{
472
- _children .remove (fieldName );
472
+ _children .remove (propertyName );
473
473
return (T ) this ;
474
474
}
475
475
@@ -479,16 +479,16 @@ public <T extends JsonNode> T without(String fieldName)
479
479
*<p>
480
480
* NOTE: co-variant return type since 2.10
481
481
*
482
- * @param fieldNames Names of fields to remove
482
+ * @param propertyNames Names of properties to remove
483
483
*
484
484
* @return This node after removing entries
485
485
*
486
486
* @since 2.1
487
487
*/
488
488
@ SuppressWarnings ("unchecked" )
489
- public <T extends JsonNode > T without (Collection <String > fieldNames )
489
+ public <T extends JsonNode > T without (Collection <String > propertyNames )
490
490
{
491
- _children .keySet ().removeAll (fieldNames );
491
+ _children .keySet ().removeAll (propertyNames );
492
492
return (T ) this ;
493
493
}
494
494
@@ -538,7 +538,7 @@ public JsonNode put(String propertyName, JsonNode value)
538
538
* @param value Value to set to property (if and only if it had no value previously);
539
539
* if null, will be converted to a {@link NullNode} first.
540
540
*
541
- * @return Old value of the field , if any (in which case value was not changed);
541
+ * @return Old value of the property , if any (in which case value was not changed);
542
542
* null if there was no old value (in which case value is now set)
543
543
*
544
544
* @since 2.13
@@ -556,28 +556,28 @@ public JsonNode putIfAbsent(String propertyName, JsonNode value)
556
556
* Will return previous value of the property, if such property existed;
557
557
* null if not.
558
558
*
559
- * @return Value of specified field , if it existed; null if not
559
+ * @return Value of specified property , if it existed; null if not
560
560
*/
561
- public JsonNode remove (String fieldName ) {
562
- return _children .remove (fieldName );
561
+ public JsonNode remove (String propertyName ) {
562
+ return _children .remove (propertyName );
563
563
}
564
564
565
565
/**
566
566
* Method for removing specified field properties out of
567
567
* this ObjectNode.
568
568
*
569
- * @param fieldNames Names of fields to remove
569
+ * @param propertyNames Names of fields to remove
570
570
*
571
571
* @return This node after removing entries
572
572
*/
573
- public ObjectNode remove (Collection <String > fieldNames )
573
+ public ObjectNode remove (Collection <String > propertyNames )
574
574
{
575
- _children .keySet ().removeAll (fieldNames );
575
+ _children .keySet ().removeAll (propertyNames );
576
576
return this ;
577
577
}
578
578
579
579
/**
580
- * Method for removing all field properties, such that this
580
+ * Method for removing all properties, such that this
581
581
* ObjectNode will contain no properties after call.
582
582
*
583
583
* @return This node after removing all entries
@@ -620,31 +620,31 @@ public JsonNode putAll(ObjectNode other) {
620
620
}
621
621
622
622
/**
623
- * Method for removing all field properties out of this ObjectNode
623
+ * Method for removing all properties out of this ObjectNode
624
624
* <b>except</b> for ones specified in argument.
625
625
*
626
- * @param fieldNames Fields to <b>retain</b> in this ObjectNode
626
+ * @param propertyNames Fields to <b>retain</b> in this ObjectNode
627
627
*
628
628
* @return This node (to allow call chaining)
629
629
*/
630
- public ObjectNode retain (Collection <String > fieldNames )
630
+ public ObjectNode retain (Collection <String > propertyNames )
631
631
{
632
- _children .keySet ().retainAll (fieldNames );
632
+ _children .keySet ().retainAll (propertyNames );
633
633
return this ;
634
634
}
635
635
636
636
/**
637
- * Method for removing all field properties out of this ObjectNode
637
+ * Method for removing all properties out of this ObjectNode
638
638
* <b>except</b> for ones specified in argument.
639
639
*
640
- * @param fieldNames Fields to <b>retain</b> in this ObjectNode
640
+ * @param propertyNames Fields to <b>retain</b> in this ObjectNode
641
641
*
642
642
* @return This node (to allow call chaining)
643
643
*/
644
- public ObjectNode retain (String ... fieldNames ) {
645
- return retain (Arrays .asList (fieldNames ));
644
+ public ObjectNode retain (String ... propertyNames ) {
645
+ return retain (Arrays .asList (propertyNames ));
646
646
}
647
-
647
+
648
648
/*
649
649
/**********************************************************
650
650
/* Extended ObjectNode API, mutators, typed
@@ -717,21 +717,25 @@ public ObjectNode putRawValue(String propertyName, RawValue raw) {
717
717
}
718
718
719
719
/**
720
+ * Method for setting value of a property to explicit {@code null} value.
721
+ *
722
+ * @param propertyName Name of property to set.
723
+ *
720
724
* @return This {@code ObjectNode} (to allow chaining)
721
725
*/
722
- public ObjectNode putNull (String fieldName )
726
+ public ObjectNode putNull (String propertyName )
723
727
{
724
- _children .put (fieldName , nullNode ());
728
+ _children .put (propertyName , nullNode ());
725
729
return this ;
726
730
}
727
731
728
732
/**
729
- * Method for setting value of a field to specified numeric value.
733
+ * Method for setting value of a property to specified numeric value.
730
734
*
731
735
* @return This node (to allow chaining)
732
736
*/
733
- public ObjectNode put (String fieldName , short v ) {
734
- return _put (fieldName , numberNode (v ));
737
+ public ObjectNode put (String propertyName , short v ) {
738
+ return _put (propertyName , numberNode (v ));
735
739
}
736
740
737
741
/**
0 commit comments