@Override public boolean currentHasChildren() { // note: ONLY to be called for container nodes return ((ContainerNode) currentNode()).size() > 0; } }
@Override public final JsonNode findPath(String fieldName) { JsonNode value = findValue(fieldName); if (value == null) { return MissingNode.getInstance(); } return value; }
@Override public boolean currentHasChildren() { // note: ONLY to be called for container nodes return ((ContainerNode) currentNode()).size() > 0; } }
/** * Get the default schema node. * * @return The default schema node. */ public static JsonNode getDefaultSchemaNode() { ObjectNode objectNode = JsonNodeFactory.instance.objectNode(); objectNode.put("type", "any"); // "required" is false by default, no need to include //objectNode.put("required", false); return objectNode; }
@Override public String toString() { return this.schema.toString(); }
/** * Method for setting value of a field to specified numeric value. */ public void put(String fieldName, BigDecimal v) { if (v == null) { putNull(fieldName); } else { _put(fieldName, numberNode(v)); } }
/** * Factory method for getting an instance of JSON null node (which * represents literal null value) */ public NullNode nullNode() { return NullNode.getInstance(); }
/** * Method for setting value of a field to specified String value. */ public void insert(int index, String v) { if (v == null) { insertNull(index); } else { _insert(index, textNode(v)); } }
/** * Method for setting value of a field to specified binary value */ public void insert(int index, byte[] v) { if (v == null) { insertNull(index); } else { _insert(index, binaryNode(v)); } }
/** * Factory method for constructing a node that represents JSON * String value */ public TextNode textNode(String text) { return TextNode.valueOf(text); }
/** * Factory method for getting an instance of JSON numeric value * that expresses given 8-bit value */ public NumericNode numberNode(byte v) { return IntNode.valueOf(v); }
/** * Factory method for getting an instance of JSON numeric value * that expresses given 64-bit floating point value */ public NumericNode numberNode(double v) { return DoubleNode.valueOf(v); }
/** * Factory method for getting an instance of JSON numeric value * that expresses given unlimited precision floating point value */ public NumericNode numberNode(BigDecimal v) { return DecimalNode.valueOf(v); }
@Override public double asDouble(double defaultValue) { return getDoubleValue(); } }
public static BinaryNode valueOf(byte[] data, int offset, int length) { if (data == null) { return null; } if (length == 0) { return EMPTY_BINARY_NODE; } return new BinaryNode(data, offset, length); }
@Override public JsonNode path(int index) { return MissingNode.getInstance(); }
protected JsonNode currentNode() { if (_closed || _nodeCursor == null) { return null; } return _nodeCursor.currentNode(); }