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

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

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

JsonNode.getValueAsLong介绍

[英]Method that will try to convert value of this node to a Java long. Numbers are coerced using default Java rules; booleans convert to 0 (false) and 1 (true), and Strings are parsed using default Java language integer parsing rules.

If representation can not be converted to an long (including structured types like Objects and Arrays), default value of 0 will be returned; no exceptions are thrown.
[中]方法,该方法将尝试将此节点的值转换为Java long。使用默认Java规则强制数字;布尔值转换为0(false)和1(true),字符串使用默认的Java语言整数解析规则进行解析。
如果无法将表示转换为long(包括对象和数组等结构化类型),则返回默认值0;没有抛出异常。

代码示例

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

/**
 * Method that will try to convert value of this node to a Java <b>long</b>.
 * Numbers are coerced using default Java rules; booleans convert to 0 (false)
 * and 1 (true), and Strings are parsed using default Java language integer
 * parsing rules.
 *<p>
 * If representation can not be converted to an long (including structured types
 * like Objects and Arrays),
 * default value of <b>0</b> will be returned; no exceptions are thrown.
 * 
 * @since 1.6
 */
public long getValueAsLong() {
  return getValueAsLong(0);
}

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

break;
case LONG:
 value = defaultValue.getValueAsLong();
 break;
case STRING:

相关文章