if (node.isInt()) { return node.asInt(); } else if (node.isLong()) { return node.asLong(); } else if (node.isDouble()) {
return jsonNode.asLong(); } else if (jsonNode.isLong()) { return jsonNode.asLong(); } else if (jsonNode.isDouble()) {
if(!defaultJson.isInt() && !defaultJson.isLong()) { expectedVal = "long";
public boolean isLong() { return delegate.isLong(); }
private Long getLongField(final JsonNode pNode, final String pFieldName) { Preconditions.checkNotNull(pNode); Preconditions.checkNotNull(pFieldName); return pNode.get(pFieldName) != null && pNode.get(pFieldName).isLong() ? pNode.get(pFieldName).getLongValue() : null; }
private Long getLongField(final JsonNode pNode, final String pFieldName) { Preconditions.checkNotNull(pNode); Preconditions.checkNotNull(pFieldName); return pNode.get(pFieldName) != null && pNode.get(pFieldName).isLong() ? pNode.get(pFieldName).getLongValue() : null; }
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 Long getLong(JsonNode node, String prop, Long defaultValue) throws JsonFormatException { if (node.get(prop) == null) { return defaultValue; } if (!node.get(prop).isLong() && !node.get(prop).isInt()) { throw new JsonFormatException("Not an long property: " + prop); } return node.get(prop).getLongValue(); }
public static Long getLong(JsonNode node, String prop, Long defaultValue) throws JsonFormatException { if (node.get(prop) == null) { return defaultValue; } if (!node.get(prop).isLong() && !node.get(prop).isInt()) { throw new JsonFormatException("Not an long property: " + prop); } return node.get(prop).getLongValue(); }
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 Long getLong(JsonNode node, String prop, Long defaultValue) throws JsonFormatException { if (node.get(prop) == null || node.get(prop).isNull()) { return defaultValue; } if (!node.get(prop).isLong() && !node.get(prop).isInt()) { throw new JsonFormatException("Not an long property: " + prop); } return node.get(prop).getLongValue(); }
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(); }
public static long getLong(JsonNode node, String prop) throws JsonFormatException { if (node.get(prop) == null) { throw new JsonFormatException("Missing required property: " + prop); } if (!node.get(prop).isLong() && !node.get(prop).isInt()) { throw new JsonFormatException("Not an long property: " + prop); } return node.get(prop).getLongValue(); }
public static long getLong(JsonNode node, String prop) throws JsonFormatException { if (node.get(prop) == null) { throw new JsonFormatException("Missing required property: " + prop); } if (!node.get(prop).isLong() && !node.get(prop).isInt()) { throw new JsonFormatException("Not an long property: " + prop); } return node.get(prop).getLongValue(); }
public static long getLong(JsonNode node, String prop) throws JsonFormatException { if (node.get(prop) == null || node.get(prop).isNull()) { throw new JsonFormatException("Missing required property: " + prop); } if (!node.get(prop).isLong() && !node.get(prop).isInt()) { throw new JsonFormatException("Not an long property: " + prop); } return node.get(prop).getLongValue(); }
private boolean isLong(final JsonNode node) { return !representsNull(node) && node.isValueNode() && node.isLong(); }
private Long getLong(final String path, final JsonNode node) { if (representsNull(node)) { return null; } checkValue(path, node, "a long"); if (!node.isLong()) { throw new IllegalArgumentException(formatExMsg(path, "is not a long")); } return node.getLongValue(); }
private Long getLong(final String path, final JsonNode node) { if (representsNull(node)) { return null; } checkValue(path, node, "a long"); if(node.isInt()) { return Long.valueOf(node.getIntValue()); } if(node.isLong()) { return node.getLongValue(); } throw new IllegalArgumentException(formatExMsg(path, "is not a long")); }
@Override public Object read(IEntity curEntity, Object valueNode, MetaField metaField) { CheckConditions.checkNotNull(metaField); CheckConditions.checkNotNull(valueNode, "Faild to read Long from %s",metaField.getName()); JsonNode jsonNode = (JsonNode)valueNode; if (jsonNode.isNull()) { return null; } CheckConditions.checkArgument(jsonNode.isInt() || jsonNode.isLong(), "Field '%s' should be long. But the value is %s", metaField.getName(), jsonNode); return jsonNode.getLongValue(); }
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())); }