/** * Clear all supplementary information * * <p>This <b>will not</b> reset the domain, keyword or message.</p> * * @return the builder */ public Builder clearInfo() { info.removeAll(); return this; }
((ObjectNode) doc).removeAll();
private void processEndArray() throws IOException { Level child; Level parent; child = stack.pop(); if( child.equals(bufferingLevel) ) { filterBufferedNode( child ); mapper.writeTree( generator, child.node ); bufferingLevel = null; bufferingConfig = null; } else if( bufferingLevel == null ) { generator.writeEndArray(); if( !stack.isEmpty() ) { parent = stack.peek(); switch( parent.node.asToken() ) { case START_ARRAY: ((ArrayNode)parent.node ).removeAll(); break; case START_OBJECT: ((ObjectNode)parent.node ).removeAll(); break; default: throw new IllegalStateException(); } } } }
private void processEndObject() throws IOException { Level child; Level parent; child = stack.pop(); if( bufferingLevel == child ) { filterBufferedNode( child ); mapper.writeTree( generator, child.node ); bufferingLevel = null; bufferingConfig = null; } else if( bufferingLevel == null ) { generator.writeEndObject(); if( !stack.isEmpty() ) { parent = stack.peek(); switch( parent.node.asToken() ) { case START_ARRAY: ((ArrayNode)parent.node ).removeAll(); break; case START_OBJECT: ((ObjectNode)parent.node ).removeAll(); break; default: throw new IllegalStateException(); } } } }
private void processEndArray() throws IOException { Level child; Level parent; child = stack.pop(); if( bufferingLevel == child ) { filterBufferedNode( child ); mapper.writeTree( generator, child.node ); bufferingLevel = null; bufferingConfig = null; } else if( bufferingLevel == null ) { generator.writeEndArray(); if( !stack.isEmpty() ) { parent = stack.peek(); switch( parent.node.asToken() ) { case START_ARRAY: ((ArrayNode)parent.node ).removeAll(); break; case START_OBJECT: ((ObjectNode)parent.node ).removeAll(); break; default: throw new IllegalStateException(); } } } }
private void processEndObject() throws IOException { Level child; Level parent; child = stack.pop(); if( child.equals(bufferingLevel) ) { filterBufferedNode( child ); mapper.writeTree( generator, child.node ); bufferingLevel = null; bufferingConfig = null; } else if( bufferingLevel == null ) { generator.writeEndObject(); if( !stack.isEmpty() ) { parent = stack.peek(); switch( parent.node.asToken() ) { case START_ARRAY: ((ArrayNode)parent.node ).removeAll(); break; case START_OBJECT: ((ObjectNode)parent.node ).removeAll(); break; default: throw new IllegalStateException(); } } } }
/** * Given a JsonObjectNode, order the fields and recursively and replace context blocks with empty nodes. * * This method is recursive. * * @param node The root of the tree of json nodes. * @param mapper The object mapper that creates and empty node. * @param preserveContext Boolean indicating whether context should be omitted. */ public static void canonicalize(JsonNode node, ObjectMapper mapper, boolean preserveContext) { if (node.isObject()) { ObjectNode objectNode = ((ObjectNode) node); if (objectNode.has("context") && !preserveContext) { objectNode.replace("context", mapper.createObjectNode()); } Iterator<Map.Entry<String, JsonNode>> iterator = objectNode.fields(); // collect and sort the entries TreeMap<String, JsonNode> fieldMap = new TreeMap<>(); while (iterator.hasNext()) { Map.Entry<String, JsonNode> entry = iterator.next(); fieldMap.put(entry.getKey(), entry.getValue()); // canonicalize all child nodes canonicalize(entry.getValue(), mapper, preserveContext); } // remove the existing entries objectNode.removeAll(); // replace the entries in sorted order objectNode.setAll(fieldMap); } }
((ArrayNode)parent.node).removeAll(); } else { ((ObjectNode)parent.node).removeAll();
((ArrayNode)parent.node).removeAll(); } else { ((ObjectNode)parent.node).removeAll();
pathNode.with(d.getApi().getPath()).with(d.getApi().getMethodType()).removeAll();