com.fasterxml.jackson.databind.JsonNode.numberType()方法的使用及代码示例

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

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

JsonNode.numberType介绍

[英]If this node is a numeric type (as per #isNumber), returns native type that node uses to store the numeric value; otherwise returns null.
[中]如果此节点是数值类型(根据#isNumber),则返回节点用于存储数值的本机类型;否则返回null。

代码示例

代码示例来源:origin: redisson/redisson

@Override
public NumberType getNumberType() throws IOException, JsonParseException {
  JsonNode n = currentNumericNode();
  return (n == null) ? null : n.numberType();
}

代码示例来源:origin: com.fasterxml.jackson.core/com.springsource.com.fasterxml.jackson.core.jackson-databind

@Override
public NumberType getNumberType() throws IOException, JsonParseException {
  JsonNode n = currentNumericNode();
  return (n == null) ? null : n.numberType();
}

代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all

@Override
public NumberType getNumberType() throws IOException, JsonParseException {
  JsonNode n = currentNumericNode();
  return (n == null) ? null : n.numberType();
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

@Override
public NumberType getNumberType() throws IOException, JsonParseException {
  JsonNode n = currentNumericNode();
  return (n == null) ? null : n.numberType();
}

代码示例来源:origin: Nextdoor/bender

@Override
public NumberType getNumberType() throws IOException, JsonParseException {
  JsonNode n = currentNumericNode();
  return (n == null) ? null : n.numberType();
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
public NumberType getNumberType() throws IOException, JsonParseException {
  JsonNode n = currentNumericNode();
  return (n == null) ? null : n.numberType();
}

代码示例来源:origin: com.jwebmp.jackson.core/jackson-databind

@Override
public NumberType getNumberType() throws IOException, JsonParseException {
  JsonNode n = currentNumericNode();
  return (n == null) ? null : n.numberType();
}

代码示例来源:origin: jneat/mybatis-jackson

@Override
public JsonParser.NumberType numberType() {
  return tree().numberType();
}

代码示例来源:origin: liveoak-io/liveoak

public static Object toRS(JsonNode value) {
  if (value.getNodeType() == JsonNodeType.STRING) {
    return value.asText();
  } else if (value.getNodeType() == JsonNodeType.NUMBER) {
    if (value.numberType() == JsonParser.NumberType.INT) {
      return value.asInt();
    } else if (value.numberType() == JsonParser.NumberType.LONG) {
      return value.asLong();
    } else if (value.numberType() == JsonParser.NumberType.DOUBLE) {
      return value.asDouble();
    }
  } else if (value.getNodeType() == JsonNodeType.BOOLEAN) {
    return value.asBoolean();
  } else if ( value instanceof ArrayNode ) {
    List<Object> array = new ArrayList<Object>();
    value.elements().forEachRemaining( (e)->{
      array.add( toRS( e ) );
    });
    return array;
  } else if (value instanceof ObjectNode) {
    return convert( (ObjectNode) value );
  }
  return null;
}

代码示例来源:origin: com.erudika/para-search-lucene

if (!(f instanceof LatLonPoint)) {
  if (val.isNumber()) {
    switch (val.numberType()) {
      case FLOAT:
      case DOUBLE:

相关文章