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

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

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

JsonNode.isIntegralNumber介绍

暂无

代码示例

代码示例来源:origin: kaaproject/kaa

if (byDefault.isIntegralNumber() && AvroUtils.getSchemaByType(schemaNode, Type.INT) != null) {
 return byDefault.asInt();
if (byDefault.isIntegralNumber() && AvroUtils.getSchemaByType(schemaNode, Type.LONG) != null) {
 return byDefault.asLong();

代码示例来源:origin: com.atlassian.jira/jira-core

public boolean isIntegralNumber()
{
  return delegate.isIntegralNumber();
}

代码示例来源:origin: oVirt/ovirt-engine

boolean checkOptionalIntegerNode(JsonNode root, String fieldName) {
  JsonNode target = root.path(fieldName);
  return !target.isMissingNode() ? target.isIntegralNumber() : true;
}

代码示例来源:origin: org.apache.isis.viewer/isis-viewer-restfulobjects-applib

private boolean isIntegralNumber(final JsonNode node) {
  return !representsNull(node) && node.isValueNode() && node.isIntegralNumber();
}

代码示例来源:origin: NGDATA/lilyproject

protected Long readLong(ValueHandle handle, ReadContext context)
    throws JsonFormatException, RepositoryException, InterruptedException {
  if (handle.node.isIntegralNumber()) {
    return handle.node.getLongValue();
  } else if (handle.node.isTextual()) {
    try {
      return Long.parseLong(handle.node.getTextValue());
    } catch (NumberFormatException e) {
      throw new JsonFormatException(String.format("Unparsable long value in property '%s': %s", handle.prop,
          handle.node.getTextValue()));
    }
  } else {
    throw new JsonFormatException("Expected long value for property '" + handle.prop + "'");
  }
}

代码示例来源:origin: eBay/YiDB

@Override
public Object read(IEntity curEntity, Object valueNode, MetaField metaField) {
  CheckConditions.checkNotNull(metaField);
  CheckConditions.checkNotNull(valueNode);
  JsonNode jsonNode = (JsonNode)valueNode;
  if (jsonNode.isNull()) {
    return null;
  }
  CheckConditions.checkArgument(jsonNode.isIntegralNumber(), "Field '%s' should be date. But the value is %s", 
      metaField.getName(), jsonNode);
  long time = jsonNode.getLongValue();
  Date date = new Date();
  date.setTime(time);
  return date;
}

代码示例来源:origin: NGDATA/lilyproject

protected Integer readInteger(ValueHandle handle, ReadContext context)
    throws JsonFormatException, RepositoryException, InterruptedException {
  if (handle.node.isIntegralNumber()) {
    return handle.node.getIntValue();
  } else if (handle.node.isTextual()) {
    try {
      return Integer.parseInt(handle.node.getTextValue());
    } catch (NumberFormatException e) {
      throw new JsonFormatException(String.format("Unparsable int value in property '%s': %s", handle.prop,
          handle.node.getTextValue()));
    }
  } else {
    throw new JsonFormatException("Expected int value for property '" + handle.prop + "'");
  }
}

代码示例来源:origin: com.googlecode.etl-unit/json-validator

private Double readBigDecimal(ObjectNode node, String property, Double default_) throws JsonSchemaValidationException {
  JsonNode reqNode = node.get(property);
  if (reqNode == null)
  {
    return default_;
  }
  // check that this object is defining a number type
  if (!reqNode.isNumber() && !reqNode.isIntegralNumber())
  {
    throw new JsonSchemaValidationException("Cannot specify property " + property + " on a non-number type", "", reqNode, null);
  }
  if (!reqNode.isNumber())
  {
    throw new JsonSchemaValidationException(property + " property must be an integer", "", reqNode, null);
  }
  return new Double(reqNode.asDouble());
}

代码示例来源:origin: com.googlecode.etl-unit/json-validator

if (node.isInt() || node.isIntegralNumber() || node.isLong() || node.isBigInteger())

相关文章