} else if (node.isLong()) { return node.asLong(); } else if (node.isDouble()) { return node.asDouble(); } else {
} else if (jsonNode.isDouble()) { if (schema == null || schema.getType().equals(Schema.Type.DOUBLE)) { return jsonNode.asDouble();
return byDefault.asBoolean(); if (byDefault.isDouble()) { if (AvroUtils.getSchemaByType(schemaNode, Type.DOUBLE) != null) { return byDefault.asDouble();
public boolean isDouble() { return delegate.isDouble(); }
private boolean hasReasonableMatchScore(JsonNode result) { double score = 0.0; if (result.has("score")) { if (result.get("score").isDouble()) { score = result.get("score").getDoubleValue(); } } return score > minMatchScore; }
public static Double getDouble(JsonNode node, String prop, Double defaultValue) throws JsonFormatException { if (node.get(prop) == null) { return defaultValue; } if (!node.get(prop).isLong() && !node.get(prop).isDouble()) { throw new JsonFormatException("Not a double property: " + prop); } return node.get(prop).getDoubleValue(); }
public static Double getDouble(JsonNode node, String prop, Double defaultValue) throws JsonFormatException { if (node.get(prop) == null) { return defaultValue; } if (!node.get(prop).isLong() && !node.get(prop).isDouble()) { throw new JsonFormatException("Not a double property: " + prop); } return node.get(prop).getDoubleValue(); }
public static Double getDouble(JsonNode node, String prop, Double defaultValue) throws JsonFormatException { if (node.get(prop) == null || node.get(prop).isNull()) { return defaultValue; } if (!node.get(prop).isLong() && !node.get(prop).isDouble()) { throw new JsonFormatException("Not a double property: " + prop); } return node.get(prop).getDoubleValue(); }
private boolean isDecimal(final JsonNode node) { return !representsNull(node) && node.isValueNode() && node.isDouble(); }
private boolean isDouble(final JsonNode node) { return !representsNull(node) && node.isValueNode() && node.isDouble(); }
private Double getDouble(final String path, final JsonNode node) { if (representsNull(node)) { return null; } checkValue(path, node, "a double"); if (!node.isDouble()) { throw new IllegalArgumentException(formatExMsg(path, "is not a double")); } return node.getDoubleValue(); }
private Double getDouble(final String path, final JsonNode node) { if (representsNull(node)) { return null; } checkValue(path, node, "a double"); if (!node.isDouble()) { throw new IllegalArgumentException(formatExMsg(path, "is not a double")); } return node.getDoubleValue(); }
private BigDecimal getBigDecimal(String path, JsonNode node) { if (node.isBigDecimal()) { return node.getDecimalValue(); } if (node.isTextual()) { return new BigDecimal(node.getTextValue()); } if (node.isLong()) { return new BigDecimal(node.getLongValue()); } if (node.isDouble()) { // there will be rounding errors, most likely return new BigDecimal(node.getDoubleValue()); } if (node.isBigInteger()) { return new BigDecimal(node.getBigIntegerValue()); } if (node.isInt()) { return new BigDecimal(node.getIntValue()); } throw new IllegalArgumentException(formatExMsg(path, "is not a bigdecimal, is not any other numeric, is not text parseable as a bigdecimal")); }
} else if (node.isLong()) { return node.asLong(); } else if (node.isDouble()) { return node.asDouble(); } else {
@Override public Object read(IEntity curEntity, Object valueNode, MetaField metaField) { CheckConditions.checkNotNull(metaField); CheckConditions.checkNotNull(valueNode); JsonNode jsonNode = (JsonNode) valueNode; if (jsonNode.isNull()) { return null; } CheckConditions.checkArgument(jsonNode.isDouble(), "Field '%s' should be double. But the value is %s", metaField.getName(), jsonNode); return jsonNode.getDoubleValue(); }
else if (node.isBoolean()) out = node.getBooleanValue(); else if (node.isDouble()) out = node.getDoubleValue(); else if (node.isInt())
private boolean isBigDecimal(final JsonNode node) { return !representsNull(node) && node.isValueNode() && (node.isBigDecimal() || node.isDouble() || node.isLong() || node.isInt() || node.isBigInteger() || node.isTextual() && parseableAsBigDecimal(node.getTextValue())); }
public static Object propertyFromJson(JsonNode node) throws LeanException { if (node.isObject()) { return typedObjectFromJson((ObjectNode) node); } else if (node.isArray()) { return typedArrayFromJson((ArrayNode) node); } else if (node.isLong()) { return node.getLongValue(); } else if (node.isInt()) { return node.getIntValue(); } else if (node.isDouble()) { return node.getDoubleValue(); } else if (node.isBoolean()) { return node.getBooleanValue(); } else if (node.isTextual()) { return node.getTextValue(); } else { throw new LeanException(LeanException.Error.ValueToJSON, " Unknown value node type."); } }
public static Object getValue(JsonNode node, TransformHelper helper) { Object out = null; if (node == null) return null; try { if (node.isTextual()) out = node.asText(); else if (node.isNull()) out = null; else if (node.isBigDecimal()) out = node.getDecimalValue(); else if (node.isBigInteger()) out = node.getBigIntegerValue(); else if (node.isBinary()) out = node.getBinaryValue(); else if (node.isBoolean()) out = node.getBooleanValue(); else if (node.isDouble()) out = node.getDoubleValue(); else if (node.isInt()) out = node.getIntValue(); else if (node.isLong()) out = node.getLongValue(); else if (node.isNumber()) out = node.getNumberValue(); } catch (IOException e) {} return out; }
public static Object getValue(JsonNode node, TransformHelper helper) { Object out = null; if (node == null) return null; try { if (node.isTextual()) out = node.asText(); else if (node.isNull()) out = null; else if (node.isBigDecimal()) out = node.getDecimalValue(); else if (node.isBigInteger()) out = node.getBigIntegerValue(); else if (node.isBinary()) out = node.getBinaryValue(); else if (node.isBoolean()) out = node.getBooleanValue(); else if (node.isDouble()) out = node.getDoubleValue(); else if (node.isInt()) out = node.getIntValue(); else if (node.isLong()) out = node.getLongValue(); else if (node.isNumber()) out = node.getNumberValue(); } catch (IOException e) {} return out; } }