Skip to content

Commit

Permalink
Warnings removal wrt deprecation of JsonNode.fields()
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Dec 28, 2024
1 parent 8bc8a9f commit b7a08c2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected void _serializeNonRecursive(JsonGenerator g, JsonNode node) throws IOE
{
if (node instanceof ObjectNode) {
g.writeStartObject(this, node.size());
_serializeNonRecursive(g, new IteratorStack(), node.fields());
_serializeNonRecursive(g, new IteratorStack(), node.properties().iterator());
} else if (node instanceof ArrayNode) {
g.writeStartArray(this, node.size());
_serializeNonRecursive(g, new IteratorStack(), node.elements());
Expand Down Expand Up @@ -127,7 +127,7 @@ protected void _serializeNonRecursive(JsonGenerator g, IteratorStack stack,
}
if (value instanceof ObjectNode) {
stack.push(currIt);
currIt = value.fields();
currIt = value.properties().iterator();
g.writeStartObject(value, value.size());
} else if (value instanceof ArrayNode) {
stack.push(currIt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ protected final static class ObjectCursor
public ObjectCursor(JsonNode n, NodeCursor p)
{
super(JsonStreamContext.TYPE_OBJECT, p);
_contents = n.fields();
_contents = n.properties().iterator();
_needEntry = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,7 @@ protected void _depositSchemaProperty(ObjectNode propertiesNode, JsonNode schema
{
JsonNode props = schemaNode.get("properties");
if (props != null) {
Iterator<Entry<String, JsonNode>> it = props.fields();
while (it.hasNext()) {
Entry<String,JsonNode> entry = it.next();
for (Entry<String,JsonNode> entry : props.properties()) {
String name = entry.getKey();
if (_nameTransformer != null) {
name = _nameTransformer.transform(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void testSimpleObject() throws Exception

// Ok, then, let's traverse via extended interface
ObjectNode obNode = (ObjectNode) root;
Iterator<Map.Entry<String,JsonNode>> fit = obNode.fields();
Iterator<Map.Entry<String,JsonNode>> fit = obNode.properties().iterator();
// we also know that LinkedHashMap is used, i.e. order preserved
assertTrue(fit.hasNext());
Map.Entry<String,JsonNode> en = fit.next();
Expand Down Expand Up @@ -143,7 +143,7 @@ public void testBasics()
assertTrue(n.isEmpty());

assertFalse(n.elements().hasNext());
assertFalse(n.fields().hasNext());
assertTrue(n.properties().isEmpty());
assertFalse(n.fieldNames().hasNext());
assertNull(n.get("a"));
assertTrue(n.path("a").isMissingNode());
Expand All @@ -153,7 +153,7 @@ public void testBasics()

assertEquals(1, n.size());
assertTrue(n.elements().hasNext());
assertTrue(n.fields().hasNext());
assertTrue(n.properties().iterator().hasNext());
assertTrue(n.fieldNames().hasNext());
assertSame(text, n.get("a"));
assertSame(text, n.path("a"));
Expand Down

0 comments on commit b7a08c2

Please sign in to comment.