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

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

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

JsonNode.isBigDecimal介绍

暂无

代码示例

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

} else if (resultNode.isLong()) {
  result = resultNode.asLong();
} else if (resultNode.isBigDecimal() || resultNode.isDouble()) {
  result = resultNode.asDouble();
} else if (resultNode.isTextual()) {

代码示例来源:origin: json-path/JsonPath

} else if (e.isLong()) {
  return e.asLong();
} else if (e.isBigDecimal()) {
  return e.decimalValue();
} else if (e.isDouble()) {
} else if (e.isFloat()) {
  return e.floatValue();
} else if (e.isBigDecimal()) {
  return e.decimalValue();
} else if (e.isNull()) {

代码示例来源:origin: com.jayway.jsonpath/json-path

} else if (e.isLong()) {
  return e.asLong();
} else if (e.isBigDecimal()) {
  return e.decimalValue();
} else if (e.isDouble()) {
} else if (e.isFloat()) {
  return e.floatValue();
} else if (e.isBigDecimal()) {
  return e.decimalValue();
} else if (e.isNull()) {

代码示例来源:origin: io.confluent.kafka/connect-utils

@Override
 public Object parseJsonNode(JsonNode input, Schema schema) {
  Preconditions.checkState(input.isBigDecimal(), "'%s' is not a '%s'", input.textValue(), expectedClass().getSimpleName());
  int scale = getScale(schema);
  return input.decimalValue().setScale(scale);
 }
}

代码示例来源:origin: walkmod/walkmod-core

public Map<String, Object> getParams(JsonNode next) {
  if (next.has("params")) {
    Iterator<Entry<String, JsonNode>> it2 = next.get("params").fields();
    Map<String, Object> params = new HashMap<String, Object>();
    while (it2.hasNext()) {
      Entry<String, JsonNode> param = it2.next();
      JsonNode value = param.getValue();
      if (value.isTextual()) {
        params.put(param.getKey(), value.asText());
      } else if (value.isInt()) {
        params.put(param.getKey(), value.asInt());
      } else if (value.isBoolean()) {
        params.put(param.getKey(), value.asBoolean());
      } else if (value.isDouble() || value.isFloat() || value.isBigDecimal()) {
        params.put(param.getKey(), value.asDouble());
      } else if (value.isLong() || value.isBigInteger()) {
        params.put(param.getKey(), value.asLong());
      } else {
        params.put(param.getKey(), value);
      }
      params.put(param.getKey(), param.getValue().asText());
    }
    return params;
  }
  return null;
}

代码示例来源:origin: org.walkmod/walkmod-core

public Map<String, Object> getParams(JsonNode next) {
  if (next.has("params")) {
    Iterator<Entry<String, JsonNode>> it2 = next.get("params").fields();
    Map<String, Object> params = new HashMap<String, Object>();
    while (it2.hasNext()) {
      Entry<String, JsonNode> param = it2.next();
      JsonNode value = param.getValue();
      if (value.isTextual()) {
        params.put(param.getKey(), value.asText());
      } else if (value.isInt()) {
        params.put(param.getKey(), value.asInt());
      } else if (value.isBoolean()) {
        params.put(param.getKey(), value.asBoolean());
      } else if (value.isDouble() || value.isFloat() || value.isBigDecimal()) {
        params.put(param.getKey(), value.asDouble());
      } else if (value.isLong() || value.isBigInteger()) {
        params.put(param.getKey(), value.asLong());
      } else {
        params.put(param.getKey(), value);
      }
      params.put(param.getKey(), param.getValue().asText());
    }
    return params;
  }
  return null;
}

代码示例来源:origin: kite-sdk/kite

} else if (datum.isBigInteger()) {
 list.add(datum.bigIntegerValue());
} else if (datum.isBigDecimal()) {
 list.add(datum.decimalValue());
} else if (datum.isNull()) {

代码示例来源:origin: com.cloudera.cdk/cdk-morphlines-json

} else if (datum.isBigInteger()) {
 list.add(datum.bigIntegerValue());
} else if (datum.isBigDecimal()) {
 list.add(datum.decimalValue());
} else if (datum.isNull()) {

代码示例来源:origin: com.github.lafa.jsonpath/json-path

} else if (e.isLong()) {
  return e.asLong();
} else if (e.isBigDecimal()) {
  return e.decimalValue();
} else if (e.isDouble()) {
} else if (e.isFloat()) {
  return e.floatValue();
} else if (e.isBigDecimal()) {
  return e.decimalValue();
} else if (e.isNull()) {

代码示例来源:origin: org.apache.olingo/odata-client-core

private EdmPrimitiveTypeKind guessPrimitiveTypeKind(final JsonNode node) {
 return node.isShort() ? EdmPrimitiveTypeKind.Int16 :
  node.isInt() ? EdmPrimitiveTypeKind.Int32 :
   node.isLong() ? EdmPrimitiveTypeKind.Int64 :
    node.isBoolean() ? EdmPrimitiveTypeKind.Boolean :
     node.isFloat() ? EdmPrimitiveTypeKind.Single :
      node.isDouble() ? EdmPrimitiveTypeKind.Double :
       node.isBigDecimal() ? EdmPrimitiveTypeKind.Decimal :
        EdmPrimitiveTypeKind.String;
}

代码示例来源:origin: apache/olingo-odata4

private EdmPrimitiveTypeKind guessPrimitiveTypeKind(final JsonNode node) {
 return node.isShort() ? EdmPrimitiveTypeKind.Int16 :
  node.isInt() ? EdmPrimitiveTypeKind.Int32 :
   node.isLong() ? EdmPrimitiveTypeKind.Int64 :
    node.isBoolean() ? EdmPrimitiveTypeKind.Boolean :
     node.isFloat() ? EdmPrimitiveTypeKind.Single :
      node.isDouble() ? EdmPrimitiveTypeKind.Double :
       node.isBigDecimal() ? EdmPrimitiveTypeKind.Decimal :
        EdmPrimitiveTypeKind.String;
}

代码示例来源:origin: apache/jackrabbit-oak

} else if (value.isDouble()) {
  tree.setProperty(name, value.asDouble());
} else if (value.isBigDecimal()) {
  tree.setProperty(name, value.decimalValue());
} else {

代码示例来源:origin: org.apache.jackrabbit/oak-http

} else if (value.isDouble()) {
  tree.setProperty(name, value.asDouble());
} else if (value.isBigDecimal()) {
  tree.setProperty(name, value.decimalValue());
} else {

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

private RelationalOperand parseRelationalOperand(JsonNode node) {
  Object value;
  if (node.isTextual()) {
    value = node.textValue();
  } else if (node.isBoolean()) {
    value = node.booleanValue();
  } else if (node.isInt()) {
    value = node.intValue();
  } else if (node.isLong()) {
    value = node.longValue();
  } else if (node.isBigInteger()) {
    value = node.bigIntegerValue();
  } else if (node.isFloat()) {
    value = node.floatValue();
  } else if (node.isDouble()) {
    value = node.doubleValue();
  } else if (node.isBigDecimal()) {
    value = node.decimalValue();
  } else if (node.isNull()) {
    value = null;
  } else {
    throw new IllegalArgumentException("Unexpected value of: " + node);
  }
  return new Value(value);
}

代码示例来源:origin: kite-sdk/kite

} else if (datum.isBigInteger()) {
 record.put(fieldName, datum.bigIntegerValue());
} else if (datum.isBigDecimal()) {
 record.put(fieldName, datum.decimalValue());
} else if (datum.isNull()) {

代码示例来源:origin: org.kitesdk/kite-morphlines-json

} else if (datum.isBigInteger()) {
 record.put(fieldName, datum.bigIntegerValue());
} else if (datum.isBigDecimal()) {
 record.put(fieldName, datum.decimalValue());
} else if (datum.isNull()) {

代码示例来源:origin: com.cloudera.cdk/cdk-morphlines-json

} else if (datum.isBigInteger()) {
 record.put(fieldName, datum.bigIntegerValue());
} else if (datum.isBigDecimal()) {
 record.put(fieldName, datum.decimalValue());
} else if (datum.isNull()) {

代码示例来源:origin: com.redhat.lightblue/lightblue-core-query-api

Object v;
if (node.isNumber()) {
  if (node.isBigDecimal() || node.isDouble() || node.isFloat()) {
    v = node.decimalValue();
  } else if (node.isBigInteger()) {

代码示例来源:origin: com.reprezen.jsonoverlay/jsonoverlay

@Override
protected Number _fromJson(JsonNode json) {
  if (json.isBigDecimal()) {
    return json.decimalValue();
  } else if (json.isBigInteger()) {
    return json.bigIntegerValue();
  }
  // no methods for Byte, even though numberNode(Byte) is provided.
  // experimentations shows that bytes show up as ints. Oh well..
  else if (json.isDouble()) {
    return json.doubleValue();
  } else if (json.isFloat()) {
    return json.floatValue();
  } else if (json.isInt()) {
    return json.intValue();
  } else if (json.isLong()) {
    return json.longValue();
  } else if (json.isShort()) {
    return json.shortValue();
  } else {
    return null;
  }
}

代码示例来源:origin: io.atlasmap/atlas-json-core

private Object handleNumberNode(JsonNode valueNode, JsonField jsonField) {
  if (valueNode.isInt()) {
    jsonField.setFieldType(FieldType.INTEGER);
    return valueNode.intValue();
  } else if (valueNode.isDouble()) {
    jsonField.setFieldType(FieldType.DOUBLE);
    return valueNode.doubleValue();
  } else if (valueNode.isBigDecimal()) {
    jsonField.setFieldType(FieldType.DECIMAL);
    return valueNode.decimalValue();
  } else if (valueNode.isFloat()) {
    jsonField.setFieldType(FieldType.DOUBLE);
    return valueNode.floatValue();
  } else if (valueNode.isLong()) {
    jsonField.setFieldType(FieldType.LONG);
    return valueNode.longValue();
  } else if (valueNode.isShort()) {
    jsonField.setFieldType(FieldType.SHORT);
    return valueNode.shortValue();
  } else if (valueNode.isBigInteger()) {
    jsonField.setFieldType(FieldType.BIG_INTEGER);
    return valueNode.bigIntegerValue();
  } else {
    jsonField.setFieldType(FieldType.NUMBER);
    return valueNode.numberValue();
  }
}

相关文章