public static FloatNode valueOf(float v) { return new FloatNode(v); }
/** * Factory method for getting an instance of JSON numeric value * that expresses given 32-bit floating point value */ @Override public NumericNode numberNode(float v) { return FloatNode.valueOf((float) v); }
@Override public BigInteger bigIntegerValue() { return decimalValue().toBigInteger(); }
@Override public void serialize(FloatNode value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException { gen.writeRaw(format(value.asDouble())); } }
@Override public void serialize(FloatNode value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException { gen.writeRaw(format(value.asDouble())); } }
return new DoubleNode((Double) object); } else if (object instanceof Float) { return new FloatNode((Float) object); } else if (object instanceof Enum) { return new TextNode(object.toString());
/** * 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(Float value) { return (value == null) ? nullNode() : FloatNode.valueOf(value.floatValue()); }
@Override public BigInteger bigIntegerValue() { return decimalValue().toBigInteger(); }
public JsonNode convert(Object node) { if (node == null) return NullNode.instance; else return new FloatNode((Float) node); } }
@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))); }
@Override public BigInteger bigIntegerValue() { return decimalValue().toBigInteger(); }
@Override public NumericNode numberNode(float v) { return new FloatNode(v); }
/** * Factory method for getting an instance of JSON numeric value * that expresses given 32-bit floating point value */ @Override public NumericNode numberNode(float v) { return FloatNode.valueOf((float) v); }
@Override public BigInteger bigIntegerValue() { return decimalValue().toBigInteger(); }
public static FloatNode valueOf(float v) { return new FloatNode(v); }
/** * Factory method for getting an instance of JSON numeric value * that expresses given 32-bit floating point value */ @Override public NumericNode numberNode(float v) { return FloatNode.valueOf((float) v); }
@Override public BigInteger bigIntegerValue() { return decimalValue().toBigInteger(); }
public static FloatNode valueOf(float v) { return new FloatNode(v); }
/** * Factory method for getting an instance of JSON numeric value * that expresses given 32-bit floating point value */ @Override public NumericNode numberNode(float v) { return FloatNode.valueOf((float) v); }