return node.asText(); } else if (node.isNumber()) { if (node.isInt()) { return node.asInt(); } else if (node.isLong()) {
} else if (jsonNode.isBoolean()) { return jsonNode.asBoolean(); } else if (jsonNode.isInt()) { if (schema == null || schema.getType().equals(Schema.Type.INT)) { return jsonNode.asInt();
schema.setMetaInfo(metaInfo); if (!object.has(VERSION) || !object.get(VERSION).isInt()) { object.put(VERSION, 1); for (JsonNode child : object.get(DEPENDENCIES)) { if (!child.isObject() || !child.has(FQN) || !child.get(FQN).isTextual() || !child.has(VERSION) || !child.get(VERSION).isInt()) { throw new IllegalArgumentException("Illegal dependency format!"); } else {
} else if (type.equals("fixed")) { // fixed JsonNode sizeNode = schema.get("size"); if (sizeNode == null || !sizeNode.isInt()) throw new SchemaParseException("Invalid or no size: "+schema); result = new FixedSchema(name, doc, sizeNode.getIntValue());
public boolean isInt() { return delegate.isInt(); }
public static int getInt(JsonNode node, String prop, int defaultValue) throws JsonFormatException { if (node.get(prop) == null) { return defaultValue; } if (!node.get(prop).isInt()) { throw new JsonFormatException("Not an integer property: " + prop); } return node.get(prop).getIntValue(); }
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 int getInt(JsonNode node, String prop, int defaultValue) throws JsonFormatException { if (node.get(prop) == null || node.get(prop).isNull()) { return defaultValue; } if (!node.get(prop).isInt()) { throw new JsonFormatException("Not an integer property: " + prop); } return node.get(prop).getIntValue(); }
public static int getInt(JsonNode node, String prop) throws JsonFormatException { if (node.get(prop) == null) { throw new JsonFormatException("Missing required property: " + prop); } if (!node.get(prop).isInt()) { throw new JsonFormatException("Not an integer property: " + prop); } return node.get(prop).getIntValue(); }
public static int getInt(JsonNode node, String prop) throws JsonFormatException { if (node.get(prop) == null) { throw new JsonFormatException("Missing required property: " + prop); } if (!node.get(prop).isInt()) { throw new JsonFormatException("Not an integer property: " + prop); } return node.get(prop).getIntValue(); }
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 int getInt(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).isInt()) { throw new JsonFormatException("Not an integer property: " + prop); } return node.get(prop).getIntValue(); }
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 Integer getInt(final String path, final JsonNode node) { if (representsNull(node)) { return null; } checkValue(path, node, "an int"); if (!node.isInt()) { throw new IllegalArgumentException(formatExMsg(path, "is not an int")); } return node.getIntValue(); }
private Integer getInt(final String path, final JsonNode node) { if (representsNull(node)) { return null; } checkValue(path, node, "an int"); if (!node.isInt()) { throw new IllegalArgumentException(formatExMsg(path, "is not an int")); } return node.getIntValue(); }
@Override Integer parse() throws ParseException { final JsonNode value = node.path(LEVEL_PROPERTY); if (value.isInt()) { return value.asInt(); } throw new ParseException("Invalid property '" + LEVEL_PROPERTY + "': value is not an integer"); }
@Override public Object read(IEntity curEntity, Object valueNode, MetaField metaField) { CheckConditions.checkNotNull(metaField); CheckConditions.checkNotNull(valueNode, "Faild to read Integer from %s",metaField.getName()); JsonNode jsonNode = (JsonNode)valueNode; if (jsonNode.isNull()) { return null; } CheckConditions.checkArgument(jsonNode.isInt(), "Field '%s' should be integer. But the value is %s", metaField.getName(), jsonNode); return jsonNode.getIntValue(); }