本文整理了Java中org.codehaus.jackson.JsonNode.isBoolean()
方法的一些代码示例,展示了JsonNode.isBoolean()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonNode.isBoolean()
方法的具体详情如下:
包路径:org.codehaus.jackson.JsonNode
类名称:JsonNode
方法名:isBoolean
[英]Method that can be used to check if this node was created from Json boolean value (literals "true" and "false").
[中]方法,该方法可用于检查此节点是否是从Json布尔值(文本“true”和“false”)创建的。
代码示例来源:origin: apache/nifi
case Types.DECIMAL:
case Types.NUMERIC:
if (fieldNode.isBoolean()) {
代码示例来源:origin: kaaproject/kaa
@Override
protected void customizeType(Record record, Schema fieldTypeSchema) {
if (record != null && record.getSchema().getName().equals(RECORD_FIELD_TYPE)) {
JsonNode addressableNode = fieldTypeSchema.getJsonProp(ADDRESSABLE);
if (addressableNode != null && addressableNode.isBoolean()) {
record.put(ADDRESSABLE, addressableNode.asBoolean());
} else {
record.put(ADDRESSABLE, true);
}
}
}
代码示例来源:origin: azkaban/azkaban
return null;
} else if (node.isBoolean()) {
return node.asBoolean();
} else {
代码示例来源:origin: org.apache.avro/avro
return defaultValue.isNumber();
case BOOLEAN:
return defaultValue.isBoolean();
case NULL:
return defaultValue.isNull();
代码示例来源:origin: org.apache.avro/avro
} else if (jsonNode.isNull()) {
return JsonProperties.NULL_VALUE;
} else if (jsonNode.isBoolean()) {
return jsonNode.asBoolean();
} else if (jsonNode.isInt()) {
代码示例来源:origin: org.apache.avro/avro
JsonNode oneWayNode = json.get("one-way");
if (oneWayNode != null) {
if (!oneWayNode.isBoolean())
throw new SchemaParseException("one-way must be boolean: "+json);
oneWay = oneWayNode.getBooleanValue();
代码示例来源:origin: apache/nifi
if (fieldNode.isBoolean()) {
return fieldNode.getBooleanValue();
代码示例来源:origin: apache/nifi
if (fieldNode.isBoolean()) {
return fieldNode.getBooleanValue();
代码示例来源:origin: voldemort/voldemort
if(!defaultJson.isBoolean()) {
expectedVal = "boolean";
代码示例来源:origin: org.apache.avro/avro
break;
case BOOLEAN:
if (!n.isBoolean())
throw new AvroTypeException("Non-boolean default for boolean: "+n);
e.writeBoolean(n.getBooleanValue());
代码示例来源:origin: kaaproject/kaa
return byteBuffer;
if (byDefault.isBoolean() && AvroUtils.getSchemaByType(schemaNode, Type.BOOLEAN) != null) {
return byDefault.asBoolean();
代码示例来源:origin: com.atlassian.jira/jira-core
public boolean isBoolean()
{
return delegate.isBoolean();
}
代码示例来源:origin: NGDATA/lilyproject
public static boolean getBoolean(JsonNode node, String prop, boolean defaultValue) throws JsonFormatException {
if (node.get(prop) == null) {
return defaultValue;
}
if (!node.get(prop).isBoolean()) {
throw new JsonFormatException("Not a string property: " + prop);
}
return node.get(prop).getBooleanValue();
}
代码示例来源:origin: NGDATA/hbase-indexer
public static Boolean getBoolean(JsonNode node, String prop, boolean defaultValue) throws JsonFormatException {
if (node.get(prop) == null) {
return defaultValue;
}
if (node.get(prop).isNull()) {
return null;
}
if (!node.get(prop).isBoolean()) {
throw new JsonFormatException("Not a boolean property: " + prop);
}
return node.get(prop).getBooleanValue();
}
代码示例来源:origin: com.ngdata/hbase-indexer-common
public static Boolean getBoolean(JsonNode node, String prop, boolean defaultValue) throws JsonFormatException {
if (node.get(prop) == null) {
return defaultValue;
}
if (node.get(prop).isNull()) {
return null;
}
if (!node.get(prop).isBoolean()) {
throw new JsonFormatException("Not a boolean property: " + prop);
}
return node.get(prop).getBooleanValue();
}
代码示例来源:origin: NGDATA/hbase-indexer
public static Boolean getBoolean(JsonNode node, String prop) throws JsonFormatException {
if (node.get(prop) == null) {
throw new JsonFormatException("Missing required property: " + prop);
}
if (node.get(prop).isNull()) {
return null;
}
if (!node.get(prop).isBoolean()) {
throw new JsonFormatException("Not a boolean property: " + prop);
}
return node.get(prop).getBooleanValue();
}
代码示例来源:origin: com.ngdata/hbase-indexer-common
public static Boolean getBoolean(JsonNode node, String prop) throws JsonFormatException {
if (node.get(prop) == null) {
throw new JsonFormatException("Missing required property: " + prop);
}
if (node.get(prop).isNull()) {
return null;
}
if (!node.get(prop).isBoolean()) {
throw new JsonFormatException("Not a boolean property: " + prop);
}
return node.get(prop).getBooleanValue();
}
代码示例来源:origin: mobi.boilr/libdynticker
@Override
protected String getTicker(Pair pair) throws IOException {
// https://www.yuanbao.com/api_market/getInfo_cny/coin/btc
JsonNode node = readJsonFromUrl(
"https://www.yuanbao.com/api_market/getInfo_cny/coin/" + pair.getCoin().toLowerCase());
if(node.get("available_supply").isBoolean())
throw new NoMarketDataException(pair);
else
return parseTicker(node, pair);
}
代码示例来源:origin: sirensolutions/siren
@Override
Integer parse() throws ParseException {
final JsonNode value = node.path(IN_ORDER_PROPERTY);
if (value.isBoolean()) {
return value.asBoolean() ? 1 : 0;
}
throw new ParseException("Invalid property '" + IN_ORDER_PROPERTY + "': value is not an boolean");
}
代码示例来源:origin: com.googlecode.etl-unit/json-validator
private boolean readBoolean(ObjectNode node, String property, boolean default_) throws JsonSchemaValidationException {
JsonNode reqNode = node.get(property);
if (reqNode == null)
{
return default_;
}
if (!reqNode.isBoolean())
{
throw new JsonSchemaValidationException(property + " property must be a boolean", "", reqNode, null);
}
return reqNode.asBoolean();
}
内容来源于网络,如有侵权,请联系作者删除!