本文整理了Java中org.codehaus.jackson.JsonNode.isInt()
方法的一些代码示例,展示了JsonNode.isInt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonNode.isInt()
方法的具体详情如下:
包路径:org.codehaus.jackson.JsonNode
类名称:JsonNode
方法名:isInt
暂无
代码示例来源:origin: azkaban/azkaban
return node.asText();
} else if (node.isNumber()) {
if (node.isInt()) {
return node.asInt();
} else if (node.isLong()) {
代码示例来源:origin: org.apache.avro/avro
} else if (jsonNode.isBoolean()) {
return jsonNode.asBoolean();
} else if (jsonNode.isInt()) {
if (schema == null || schema.getType().equals(Schema.Type.INT)) {
return jsonNode.asInt();
代码示例来源:origin: kaaproject/kaa
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 {
代码示例来源:origin: voldemort/voldemort
if(!defaultJson.isInt()) {
expectedVal = "int";
if(!defaultJson.isInt() && !defaultJson.isLong()) {
expectedVal = "long";
代码示例来源:origin: org.apache.avro/avro
} 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());
代码示例来源:origin: com.atlassian.jira/jira-core
public boolean isInt()
{
return delegate.isInt();
}
代码示例来源:origin: NGDATA/hbase-indexer
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();
}
代码示例来源:origin: NGDATA/hbase-indexer
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();
}
代码示例来源:origin: NGDATA/lilyproject
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();
}
代码示例来源:origin: com.ngdata/hbase-indexer-common
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();
}
代码示例来源:origin: NGDATA/hbase-indexer
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();
}
代码示例来源:origin: NGDATA/lilyproject
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();
}
代码示例来源:origin: com.ngdata/hbase-indexer-common
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();
}
代码示例来源:origin: com.ngdata/hbase-indexer-common
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();
}
代码示例来源:origin: NGDATA/hbase-indexer
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();
}
代码示例来源:origin: com.ngdata/hbase-indexer-common
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();
}
代码示例来源:origin: org.apache.isis.viewer/isis-viewer-restfulobjects-applib
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();
}
代码示例来源:origin: org.apache.isis.viewer/json-applib
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();
}
代码示例来源:origin: rdelbru/SIREn
@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");
}
代码示例来源:origin: eBay/YiDB
@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();
}
内容来源于网络,如有侵权,请联系作者删除!