/** * 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 32-bit floating point value */ public NumericNode numberNode(float v) { return DoubleNode.valueOf((double) 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}. * * @since 1.9 */ 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}. * * @since 1.9 */ public ValueNode numberNode(Float value) { return (value == null) ? nullNode() : DoubleNode.valueOf(value.doubleValue()); }
/** * 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); }
/** * 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}. * * @since 1.9 */ 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}. * * @since 1.9 */ public ValueNode numberNode(Float value) { return (value == null) ? nullNode() : DoubleNode.valueOf(value.doubleValue()); }
/** * 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 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 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); }
/** * 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}. * * @since 1.9 */ 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}. * * @since 1.9 */ 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}. * * @since 1.9 */ 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}. * * @since 1.9 */ public ValueNode numberNode(Double value) { return (value == null) ? nullNode() : DoubleNode.valueOf(value.doubleValue()); }
private void whenReprIsDouble(final Class<?> correspondingClass) { // given allowingObjectSpecHas(EncodableFacet.class, encodableFacet); allowingObjectSpecCorrespondingClassIs(correspondingClass); final double value = 123.45; representation = new JsonRepresentation(DoubleNode.valueOf(value)); context.checking(new Expectations() { { one(encodableFacet).fromEncodedString("" + value); will(returnValue(objectAdapter)); } }); // when final ObjectAdapter adapter = jsonValueEncoder.asAdapter(objectSpec, representation); // then assertSame(objectAdapter, adapter); }
private void whenReprIsDouble(final Class<?> correspondingClass) { // given allowingObjectSpecHas(EncodableFacet.class, mockEncodableFacet); allowingObjectSpecCorrespondingClassAndSpecIdIs(correspondingClass); final double value = 123.45; representation = new JsonRepresentation(DoubleNode.valueOf(value)); context.checking(new Expectations() { { oneOf(mockAdapterManager).adapterFor(value); will(returnValue(mockObjectAdapter)); } }); // when final ObjectAdapter adapter = JsonValueEncoder.asAdapter(mockObjectSpec, representation, null); // then assertSame(mockObjectAdapter, adapter); }