本文整理了Java中org.codehaus.jackson.JsonNode.getValueAsDouble()
方法的一些代码示例,展示了JsonNode.getValueAsDouble()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonNode.getValueAsDouble()
方法的具体详情如下:
包路径:org.codehaus.jackson.JsonNode
类名称:JsonNode
方法名:getValueAsDouble
[英]Method that will try to convert value of this node to a Java double. Numbers are coerced using default Java rules; booleans convert to 0.0 (false) and 1.0 (true), and Strings are parsed using default Java language integer parsing rules.
If representation can not be converted to an int (including structured types like Objects and Arrays), default value of 0.0 will be returned; no exceptions are thrown.
[中]方法,该方法将尝试将此节点的值转换为Java double。使用默认Java规则强制数字;布尔值转换为0.0(false)和1.0(true),字符串使用默认的Java语言整数解析规则进行解析。
如果表示不能转换为int(包括对象和数组等结构化类型),则返回默认值0.0;没有抛出异常。
代码示例来源:origin: com.barchart.wrap/barchart-wrap-jackson
/**
* Method that will try to convert value of this node to a Java <b>double</b>.
* Numbers are coerced using default Java rules; booleans convert to 0.0 (false)
* and 1.0 (true), and Strings are parsed using default Java language integer
* parsing rules.
*<p>
* If representation can not be converted to an int (including structured types
* like Objects and Arrays),
* default value of <b>0.0</b> will be returned; no exceptions are thrown.
*
* @since 1.6
*/
public double getValueAsDouble() {
return getValueAsDouble(0.0);
}
代码示例来源:origin: com.moz.fiji.schema/fiji-schema
/** {@inheritDoc} */
@Override
public FijiRowFilter createFromJson(JsonNode rootNode) {
float chance = (float) rootNode.path(CHANCE_NODE).getValueAsDouble();
return new FijiRandomRowFilter(chance);
}
}
代码示例来源:origin: jwills/avro-json
break;
case DOUBLE:
value = defaultValue.getValueAsDouble();
break;
case FLOAT:
value = (float) defaultValue.getValueAsDouble();
break;
case INT:
内容来源于网络,如有侵权,请联系作者删除!