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

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

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

JsonNode.getValueAsInt介绍

[英]Method that will try to convert value of this node to a Java int. 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 int (including structured types like Objects and Arrays), default value of 0 will be returned; no exceptions are thrown.
[中]方法,该方法将尝试将此节点的值转换为Java int;布尔值转换为0(false)和1(true),字符串使用默认的Java语言整数解析规则进行解析。
如果表示不能转换为int(包括对象和数组等结构化类型),则返回默认值0;没有抛出异常。

代码示例

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

int maxLength = 0;
try {
 maxLength = schema.getJsonProp(AvroSerDe.AVRO_PROP_MAX_LENGTH).getValueAsInt();
} catch (Exception ex) {
 throw new AvroSerdeException("Failed to obtain maxLength value from file schema: " + schema, ex);
int maxLength = 0;
try {
 maxLength = schema.getJsonProp(AvroSerDe.AVRO_PROP_MAX_LENGTH).getValueAsInt();
} catch (Exception ex) {
 throw new AvroSerdeException("Failed to obtain maxLength value from file schema: " + schema, ex);

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

maxLength = fileSchema.getJsonProp(AvroSerDe.AVRO_PROP_MAX_LENGTH).getValueAsInt();
} catch (Exception ex) {
 throw new AvroSerdeException("Failed to obtain maxLength value for char field from file schema: " + fileSchema, ex);
 maxLength = fileSchema.getJsonProp(AvroSerDe.AVRO_PROP_MAX_LENGTH).getValueAsInt();
} catch (Exception ex) {
 throw new AvroSerdeException("Failed to obtain maxLength value for varchar field from file schema: " + fileSchema, ex);

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

/**
 * Method that will try to convert value of this node to a Java <b>int</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 int (including structured types
 * like Objects and Arrays),
 * default value of <b>0</b> will be returned; no exceptions are thrown.
 * 
 * @since 1.6
 */
public int getValueAsInt() {
  return getValueAsInt(0);
}

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

break;
case INT:
 value = defaultValue.getValueAsInt();
 break;
case LONG:

代码示例来源:origin: org.spark-project.hive/hive-serde

maxLength = fileSchema.getJsonProp(AvroSerDe.AVRO_PROP_MAX_LENGTH).getValueAsInt();
} catch (Exception ex) {
 throw new AvroSerdeException("Failed to obtain maxLength value for char field from file schema: " + fileSchema, ex);
 maxLength = fileSchema.getJsonProp(AvroSerDe.AVRO_PROP_MAX_LENGTH).getValueAsInt();
} catch (Exception ex) {
 throw new AvroSerdeException("Failed to obtain maxLength value for varchar field from file schema: " + fileSchema, ex);

代码示例来源:origin: com.github.hyukjinkwon/hive-serde

maxLength = fileSchema.getJsonProp(AvroSerDe.AVRO_PROP_MAX_LENGTH).getValueAsInt();
} catch (Exception ex) {
 throw new AvroSerdeException("Failed to obtain maxLength value for char field from file schema: " + fileSchema, ex);
 maxLength = fileSchema.getJsonProp(AvroSerDe.AVRO_PROP_MAX_LENGTH).getValueAsInt();
} catch (Exception ex) {
 throw new AvroSerdeException("Failed to obtain maxLength value for varchar field from file schema: " + fileSchema, ex);

代码示例来源:origin: org.apache.hive/hive-serde

maxLength = fileSchema.getJsonProp(AvroSerDe.AVRO_PROP_MAX_LENGTH).getValueAsInt();
} catch (Exception ex) {
 throw new AvroSerdeException("Failed to obtain maxLength value for char field from file schema: " + fileSchema, ex);
 maxLength = fileSchema.getJsonProp(AvroSerDe.AVRO_PROP_MAX_LENGTH).getValueAsInt();
} catch (Exception ex) {
 throw new AvroSerdeException("Failed to obtain maxLength value for varchar field from file schema: " + fileSchema, ex);

代码示例来源:origin: org.apache.hive/hive-serde

int maxLength = 0;
try {
 maxLength = schema.getJsonProp(AvroSerDe.AVRO_PROP_MAX_LENGTH).getValueAsInt();
} catch (Exception ex) {
 throw new AvroSerdeException("Failed to obtain maxLength value from file schema: " + schema, ex);
int maxLength = 0;
try {
 maxLength = schema.getJsonProp(AvroSerDe.AVRO_PROP_MAX_LENGTH).getValueAsInt();
} catch (Exception ex) {
 throw new AvroSerdeException("Failed to obtain maxLength value from file schema: " + schema, ex);

代码示例来源:origin: com.github.hyukjinkwon/hive-serde

int maxLength = 0;
try {
 maxLength = schema.getJsonProp(AvroSerDe.AVRO_PROP_MAX_LENGTH).getValueAsInt();
} catch (Exception ex) {
 throw new AvroSerdeException("Failed to obtain maxLength value from file schema: " + schema, ex);
int maxLength = 0;
try {
 maxLength = schema.getJsonProp(AvroSerDe.AVRO_PROP_MAX_LENGTH).getValueAsInt();
} catch (Exception ex) {
 throw new AvroSerdeException("Failed to obtain maxLength value from file schema: " + schema, ex);

代码示例来源:origin: org.spark-project.hive/hive-serde

int maxLength = 0;
try {
 maxLength = schema.getJsonProp(AvroSerDe.AVRO_PROP_MAX_LENGTH).getValueAsInt();
} catch (Exception ex) {
 throw new AvroSerdeException("Failed to obtain maxLength value from file schema: " + schema, ex);
int maxLength = 0;
try {
 maxLength = schema.getJsonProp(AvroSerDe.AVRO_PROP_MAX_LENGTH).getValueAsInt();
} catch (Exception ex) {
 throw new AvroSerdeException("Failed to obtain maxLength value from file schema: " + schema, ex);

相关文章