org.codehaus.jackson.JsonNode.getValueAsBoolean()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中org.codehaus.jackson.JsonNode.getValueAsBoolean()方法的一些代码示例,展示了JsonNode.getValueAsBoolean()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonNode.getValueAsBoolean()方法的具体详情如下:
包路径:org.codehaus.jackson.JsonNode
类名称:JsonNode
方法名:getValueAsBoolean

JsonNode.getValueAsBoolean介绍

[英]Method that will try to convert value of this node to a Java boolean. JSON booleans map naturally; integer numbers other than 0 map to true, and 0 maps to false and Strings 'true' and 'false' map to corresponding values.

If representation can not be converted to a boolean value (including structured types like Objects and Arrays), default value of false will be returned; no exceptions are thrown.
[中]

代码示例

代码示例来源:origin: com.barchart.wrap/barchart-wrap-jackson

/**
 * Method that will try to convert value of this node to a Java <b>boolean</b>.
 * JSON booleans map naturally; integer numbers other than 0 map to true, and
 * 0 maps to false
 * and Strings 'true' and 'false' map to corresponding values.
 *<p>
 * If representation can not be converted to a boolean value (including structured types
 * like Objects and Arrays),
 * default value of <b>false</b> will be returned; no exceptions are thrown.
 * 
 * @since 1.7
 */
public boolean getValueAsBoolean() {
  return getValueAsBoolean(false);
}

代码示例来源:origin: org.apache.eagle/eagle-entity-base

entity.setMeta(objectCodec.readValue(field.getValue().traverse(), Map.class));
else if(SUCCESS_FIELD.equals(field.getKey()) && field.getValue() != null){
  entity.setSuccess(field.getValue().getValueAsBoolean(false));
}else if(EXCEPTION_FIELD.equals(field.getKey()) && field.getValue() != null){
  entity.setException(field.getValue().getTextValue());

代码示例来源:origin: jwills/avro-json

switch (fieldSchema.getType()) {
case BOOLEAN:
 value = defaultValue.getValueAsBoolean();
 break;
case DOUBLE:

代码示例来源:origin: apache/sentry

public boolean isHA() {
 JsonNode gauges = getGauges(root);
 JsonNode obj = getValue(gauges.findPath(sentryService + ".is_ha"));
 return obj.getValueAsBoolean();
}

相关文章