/** * Factory method for getting an instance of JSON numeric value * that expresses given 64-bit floating point value */ @Override public NumericNode numberNode(double v) { return DoubleNode.valueOf(v); }
/** * 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(Double value) { return (value == null) ? nullNode() : DoubleNode.valueOf(value.doubleValue()); }
@Test public void testToJsonNode() { assertEquals(null, toJsonNode(null)); assertEquals(NullNode.getInstance(), toJsonNode(JsonProperties.NULL_VALUE)); assertEquals(BooleanNode.TRUE, toJsonNode(true)); assertEquals(IntNode.valueOf(1), toJsonNode(1)); assertEquals(LongNode.valueOf(2), toJsonNode(2L)); assertEquals(FloatNode.valueOf(1.0f), toJsonNode(1.0f)); assertEquals(DoubleNode.valueOf(2.0), toJsonNode(2.0)); assertEquals(TextNode.valueOf("\u0001\u0002"), toJsonNode(new byte[] { 1, 2 })); assertEquals(TextNode.valueOf("a"), toJsonNode("a")); assertEquals(TextNode.valueOf("UP"), toJsonNode(Direction.UP)); ArrayNode an = JsonNodeFactory.instance.arrayNode(); an.add(1); assertEquals(an, toJsonNode(Collections.singletonList(1))); ObjectNode on = JsonNodeFactory.instance.objectNode(); on.put("a", 1); assertEquals(on, toJsonNode(Collections.singletonMap("a", 1))); }
} else if (value.getN() != null) { double v = Double.parseDouble(value.getN()); return DoubleNode.valueOf(v); } else if (value.getL() != null) { ArrayNode arr = JsonHelper.jsonArray();
/** * Factory method for getting an instance of JSON numeric value * that expresses given 64-bit floating point value */ @Override public NumericNode numberNode(double v) { return DoubleNode.valueOf(v); }
/** * Factory method for getting an instance of JSON numeric value * that expresses given 32-bit floating point value */ public NumericNode numberNode(float v) { return DoubleNode.valueOf((double) v); }
/** * Factory method for getting an instance of JSON numeric value * that expresses given 64-bit floating point value */ @Override public NumericNode numberNode(double v) { return DoubleNode.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 64-bit floating point value */ @Override public NumericNode numberNode(double v) { return DoubleNode.valueOf(v); }
/** * Factory method for getting an instance of JSON numeric value * that expresses given 32-bit floating point value */ public NumericNode numberNode(float v) { return DoubleNode.valueOf((double) 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 64-bit floating point value */ @Override public NumericNode numberNode(double v) { return DoubleNode.valueOf(v); }
public Record set(String key, double v) { map.set(key, DoubleNode.valueOf(v)); return this; }
/** * 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(Double value) { return (value == null) ? nullNode() : DoubleNode.valueOf(value.doubleValue()); }
/** * 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}. */ public ValueNode numberNode(Double value) { return (value == null) ? nullNode() : DoubleNode.valueOf(value.doubleValue()); }
/** * 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(Double value) { return (value == null) ? nullNode() : DoubleNode.valueOf(value.doubleValue()); }
/** * 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(Double value) { return (value == null) ? nullNode() : DoubleNode.valueOf(value.doubleValue()); }
/** * 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}. */ public ValueNode numberNode(Float value) { return (value == null) ? nullNode() : DoubleNode.valueOf(value.doubleValue()); }
/** * 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}. */ public ValueNode numberNode(Float value) { return (value == null) ? nullNode() : DoubleNode.valueOf(value.doubleValue()); }
/** * 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}. */ public ValueNode numberNode(Double value) { return (value == null) ? nullNode() : DoubleNode.valueOf(value.doubleValue()); }