Java Code Examples for com.fasterxml.jackson.databind.node.DoubleNode#valueOf()
The following examples show how to use
com.fasterxml.jackson.databind.node.DoubleNode#valueOf() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JacksonScalars.java From graphql-spqr with Apache License 2.0 | 5 votes |
@Override public DoubleNode parseValue(Object input) { if (input instanceof Number || input instanceof String) { return DoubleNode.valueOf(new BigDecimal(input.toString()).doubleValue()); } if (input instanceof DoubleNode) { return (DoubleNode) input; } throw valueParsingException(input, Number.class, String.class, DoubleNode.class); }
Example 2
Source File: JacksonScalars.java From graphql-spqr with Apache License 2.0 | 5 votes |
@Override public DoubleNode parseLiteral(Object input) { if (input instanceof IntValue) { return DoubleNode.valueOf(((IntValue) input).getValue().doubleValue()); } if (input instanceof FloatValue) { return DoubleNode.valueOf(((FloatValue) input).getValue().doubleValue()); } else { throw new CoercingParseLiteralException(errorMessage(input, IntValue.class, FloatValue.class)); } }
Example 3
Source File: Serializer.java From james-project with Apache License 2.0 | 4 votes |
@Override public JsonNode serialize(Double object) { return DoubleNode.valueOf(object); }