/** * Alternate factory method that will handle wrapper value, which may * be null. * Due to possibility of null, returning type is not guaranteed to be * {@link NumericNode}, but just {@link ValueNode}. */ @Override public ValueNode numberNode(Short value) { return (value == null) ? nullNode() : ShortNode.valueOf(value); }
@Override public boolean isNaN() { if (!_closed) { JsonNode n = currentNode(); if (n instanceof NumericNode) { return ((NumericNode) n).isNaN(); } } return false; }
protected ObjectNode createSchemaNode(String type) { ObjectNode schema = JsonNodeFactory.instance.objectNode(); schema.put("type", type); return schema; }
/** * Factory method that constructs and returns an empty {@link ArrayNode} * Construction is done using registered {@link JsonNodeFactory}. */ @Override public final ArrayNode arrayNode() { return _nodeFactory.arrayNode(); }
/** * Factory method for constructing an empty JSON Object ("struct") node */ @Override public ObjectNode objectNode() { return new ObjectNode(this); }
@Override public final JsonNode findPath(String fieldName) { JsonNode value = findValue(fieldName); if (value == null) { return MissingNode.getInstance(); } return value; }
/** * Method for setting value of a field to specified numeric value. * * @return This node (to allow chaining) */ public ObjectNode put(String fieldName, BigDecimal v) { return _put(fieldName, (v == null) ? nullNode() : numberNode(v)); }
/** * Method for setting value of a field to specified binary value * * @return This node (to allow chaining) */ public ObjectNode put(String fieldName, byte[] v) { return _put(fieldName, (v == null) ? nullNode() : binaryNode(v)); }
/** * Method that will insert specified numeric value * at specified position in this array. * * @return This array node, to allow chaining */ public ArrayNode insert(int index, BigDecimal v) { if (v == null) { return insertNull(index); } return _insert(index, numberNode(v)); }
@Override public boolean currentHasChildren() { // note: ONLY to be called for container nodes return ((ContainerNode<?>) currentNode()).size() > 0; } }
@Override public boolean currentHasChildren() { // note: ONLY to be called for container nodes return ((ContainerNode<?>) currentNode()).size() > 0; } }
/** * Method for adding specified number at the end of this array. * * @return This array node, to allow chaining */ public ArrayNode add(int v) { _add(numberNode(v)); return this; }
/** * Method that will insert specified String * at specified position in this array. * * @return This array node, to allow chaining */ public ArrayNode insert(int index, boolean v) { return _insert(index, booleanNode(v)); }
@Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (o instanceof POJONode) { return _pojoEquals((POJONode) o); } return false; }
/** * 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; }
/** * Method for adding specified number at the end of this array. * * @return This array node, to allow chaining */ public ArrayNode add(double v) { return _add(numberNode(v)); }