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

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

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

JsonNode.isLong介绍

暂无

代码示例

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

if (node.isInt()) {
 return node.asInt();
} else if (node.isLong()) {
 return node.asLong();
} else if (node.isDouble()) {

代码示例来源:origin: org.apache.avro/avro

return jsonNode.asLong();
} else if (jsonNode.isLong()) {
 return jsonNode.asLong();
} else if (jsonNode.isDouble()) {

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

if(!defaultJson.isInt() && !defaultJson.isLong()) {
  expectedVal = "long";

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

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

代码示例来源:origin: apache/incubator-sentry

private Long getLongField(final JsonNode pNode, final String pFieldName) {
  Preconditions.checkNotNull(pNode);
  Preconditions.checkNotNull(pFieldName);
  return pNode.get(pFieldName) != null && pNode.get(pFieldName).isLong() ? pNode.get(pFieldName).getLongValue()
    : null;
}

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

private Long getLongField(final JsonNode pNode, final String pFieldName) {
  Preconditions.checkNotNull(pNode);
  Preconditions.checkNotNull(pFieldName);
  return pNode.get(pFieldName) != null && pNode.get(pFieldName).isLong() ? pNode.get(pFieldName).getLongValue()
    : null;
}

代码示例来源:origin: NGDATA/hbase-indexer

public static Double getDouble(JsonNode node, String prop, Double defaultValue) throws JsonFormatException {
  if (node.get(prop) == null) {
    return defaultValue;
  }
  if (!node.get(prop).isLong() && !node.get(prop).isDouble()) {
    throw new JsonFormatException("Not a double property: " + prop);
  }
  return node.get(prop).getDoubleValue();
}

代码示例来源:origin: NGDATA/hbase-indexer

public static Long getLong(JsonNode node, String prop, Long defaultValue) throws JsonFormatException {
  if (node.get(prop) == null) {
    return defaultValue;
  }
  if (!node.get(prop).isLong() && !node.get(prop).isInt()) {
    throw new JsonFormatException("Not an long property: " + prop);
  }
  return node.get(prop).getLongValue();
}

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

public static Long getLong(JsonNode node, String prop, Long defaultValue) throws JsonFormatException {
  if (node.get(prop) == null) {
    return defaultValue;
  }
  if (!node.get(prop).isLong() && !node.get(prop).isInt()) {
    throw new JsonFormatException("Not an long property: " + prop);
  }
  return node.get(prop).getLongValue();
}

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

public static Double getDouble(JsonNode node, String prop, Double defaultValue) throws JsonFormatException {
  if (node.get(prop) == null) {
    return defaultValue;
  }
  if (!node.get(prop).isLong() && !node.get(prop).isDouble()) {
    throw new JsonFormatException("Not a double property: " + prop);
  }
  return node.get(prop).getDoubleValue();
}

代码示例来源:origin: com.ngdata/hbase-indexer-common

public static Long getLong(JsonNode node, String prop, Long defaultValue) throws JsonFormatException {
  if (node.get(prop) == null || node.get(prop).isNull()) {
    return defaultValue;
  }
  if (!node.get(prop).isLong() && !node.get(prop).isInt()) {
    throw new JsonFormatException("Not an long property: " + prop);
  }
  return node.get(prop).getLongValue();
}

代码示例来源:origin: com.ngdata/hbase-indexer-common

public static Double getDouble(JsonNode node, String prop, Double defaultValue) throws JsonFormatException {
  if (node.get(prop) == null || node.get(prop).isNull()) {
    return defaultValue;
  }
  if (!node.get(prop).isLong() && !node.get(prop).isDouble()) {
    throw new JsonFormatException("Not a double property: " + prop);
  }
  return node.get(prop).getDoubleValue();
}

代码示例来源:origin: NGDATA/hbase-indexer

public static long getLong(JsonNode node, String prop) throws JsonFormatException {
  if (node.get(prop) == null) {
    throw new JsonFormatException("Missing required property: " + prop);
  }
  if (!node.get(prop).isLong() && !node.get(prop).isInt()) {
    throw new JsonFormatException("Not an long property: " + prop);
  }
  return node.get(prop).getLongValue();
}

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

public static long getLong(JsonNode node, String prop) throws JsonFormatException {
  if (node.get(prop) == null) {
    throw new JsonFormatException("Missing required property: " + prop);
  }
  if (!node.get(prop).isLong() && !node.get(prop).isInt()) {
    throw new JsonFormatException("Not an long property: " + prop);
  }
  return node.get(prop).getLongValue();
}

代码示例来源:origin: com.ngdata/hbase-indexer-common

public static long getLong(JsonNode node, String prop) throws JsonFormatException {
  if (node.get(prop) == null || node.get(prop).isNull()) {
    throw new JsonFormatException("Missing required property: " + prop);
  }
  if (!node.get(prop).isLong() && !node.get(prop).isInt()) {
    throw new JsonFormatException("Not an long property: " + prop);
  }
  return node.get(prop).getLongValue();
}

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

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

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

private Long getLong(final String path, final JsonNode node) {
  if (representsNull(node)) {
    return null;
  }
  checkValue(path, node, "a long");
  if (!node.isLong()) {
    throw new IllegalArgumentException(formatExMsg(path, "is not a long"));
  }
  return node.getLongValue();
}

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

private Long getLong(final String path, final JsonNode node) {
  if (representsNull(node)) {
    return null;
  }
  checkValue(path, node, "a long");
  if(node.isInt()) {
    return Long.valueOf(node.getIntValue());
  }
  if(node.isLong()) {
    return node.getLongValue();
  }
  throw new IllegalArgumentException(formatExMsg(path, "is not a long"));
}

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

@Override
public Object read(IEntity curEntity, Object valueNode, MetaField metaField) {
  CheckConditions.checkNotNull(metaField);
  CheckConditions.checkNotNull(valueNode, "Faild to read Long from %s",metaField.getName());
  JsonNode jsonNode = (JsonNode)valueNode;
  if (jsonNode.isNull()) {
    return null;
  }
  CheckConditions.checkArgument(jsonNode.isInt() || jsonNode.isLong(), "Field '%s' should be long. But the value is %s",
      metaField.getName(), jsonNode);
  return jsonNode.getLongValue();
}

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

private boolean isBigDecimal(final JsonNode node) {
  return !representsNull(node) && node.isValueNode() && (node.isBigDecimal() || node.isDouble() || node.isLong() || node.isInt() || node.isBigInteger() || node.isTextual() && parseableAsBigDecimal(node.getTextValue()));
}

相关文章