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

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

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

JsonNode.getIntValue介绍

[英]Returns integer value for this node, if and only if this node is numeric ( #isNumber returns true). For other types returns 0. For floating-point numbers, value is truncated using default Java coercion, similar to how cast from double to int operates.
[中]返回此节点的整数值,当且仅当此节点为数字时(#isNumber返回true)。对于其他类型,返回0。对于浮点数,使用默认Java强制来截断值,类似于从double转换为int的操作方式。

代码示例

代码示例来源:origin: org.codehaus.jackson/jackson-mapper-asl

@Override
public int getIntValue() throws IOException, JsonParseException {
  return currentNumericNode().getIntValue();
}

代码示例来源:origin: linkedin/parseq

private static int getIntField(final JsonNode node, final String fieldName) throws IOException {
 return getField(node, fieldName).getIntValue();
}

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

private List<FileData> recursiveShallowExport(List<FileData> files, CTLSchemaDto parent) throws
     Exception {
  files.add(this.shallowExport(parent));
  ObjectNode object = new ObjectMapper().readValue(parent.getBody(), ObjectNode.class);
  ArrayNode dependencies = (ArrayNode) object.get(DEPENDENCIES);
  if (dependencies != null) {
   for (JsonNode node : dependencies) {
    ObjectNode dependency = (ObjectNode) node;
    String fqn = dependency.get(FQN).getTextValue();
    Integer version = dependency.get(VERSION).getIntValue();
    CTLSchemaDto child = this.findAnyCtlSchemaByFqnAndVerAndTenantIdAndApplicationId(
        fqn, version, parent.getMetaInfo().getTenantId(),
        parent.getMetaInfo().getApplicationId());
    Validate.notNull(child, MessageFormat.format("The dependency [{0}] was not found!", fqn));
    this.recursiveShallowExport(files, child);
   }
  }
  return files;
 }
}

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

int scale = 0;
try {
 precision = schema.getJsonProp(AvroSerDe.AVRO_PROP_PRECISION).getIntValue();
 scale = schema.getJsonProp(AvroSerDe.AVRO_PROP_SCALE).getIntValue();
} catch (Exception ex) {
 throw new AvroSerdeException("Failed to obtain scale value from file schema: " + schema, ex);

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

if (sizeNode == null || !sizeNode.isInt())
  throw new SchemaParseException("Invalid or no size: "+schema);
 result = new FixedSchema(name, doc, sizeNode.getIntValue());
 if (name != null) names.add(result);
} else

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

if (!n.isNumber())
  throw new AvroTypeException("Non-numeric default value for int: "+n);
 e.writeInt(n.getIntValue());
 break;
case LONG:

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
public int getIntValue() throws IOException, JsonParseException {
  return currentNumericNode().getIntValue();
}

代码示例来源:origin: youseries/urule

private List<Line> parseLines(JsonNode node){
  JsonNode lineNodes=node.get("lines");
  if(lineNodes==null){
    return null;
  }
  List<Line> lines=new ArrayList<Line>();
  Iterator<JsonNode> iter=lineNodes.iterator();
  while(iter.hasNext()){
    JsonNode jsonNode=iter.next();
    Line line=new Line();
    line.setFromNodeId(jsonNode.get("fromNodeId").getIntValue());
    line.setToNodeId(jsonNode.get("toNodeId").getIntValue());
    lines.add(line);
  }
  return lines;
}

代码示例来源:origin: klout/brickhouse

return jsonNode.getLongValue();
case SHORT:
  return (short) jsonNode.getIntValue();
case BYTE:
  return (byte) jsonNode.getIntValue();
case BINARY:
  try {
  return jsonNode.getIntValue();
case FLOAT:
  return new Float(jsonNode.getDoubleValue());

代码示例来源:origin: youseries/urule

while(childrenNodesIter.hasNext()){
  JsonNode childNode=childrenNodesIter.next();
  int id=childNode.get("id").getIntValue();
  JsonNode nodeTypeNode = childNode.get("nodeType");
  if(nodeTypeNode==null){
    AndNode node=(AndNode)reteNode;
    node.setId(id);
    node.setToLineCount(childNode.get("toLineCount").getIntValue());
    node.setLines(parseLines(childNode));
  }else if(reteNode instanceof OrNode){

代码示例来源:origin: youseries/urule

item.setScript(itemNode.get("script").getTextValue());        				
}else{
  item.setPercent(itemNode.get("percent").getIntValue());

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.clients

/**
 * @return the service identifier
 */
public int getId() {
  return service.get("id").getIntValue();
}

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

public static int getInt(JsonNode node, String prop, int defaultValue) throws JsonFormatException {
  if (node.get(prop) == null) {
    return defaultValue;
  }
  if (!node.get(prop).isInt()) {
    throw new JsonFormatException("Not an integer property: " + prop);
  }
  return node.get(prop).getIntValue();
}

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

public static int getInt(JsonNode node, String prop) throws JsonFormatException {
  if (node.get(prop) == null) {
    throw new JsonFormatException("Missing required property: " + prop);
  }
  if (!node.get(prop).isInt()) {
    throw new JsonFormatException("Not an integer property: " + prop);
  }
  return node.get(prop).getIntValue();
}

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

public static int getInt(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).isInt()) {
    throw new JsonFormatException("Not an integer property: " + prop);
  }
  return node.get(prop).getIntValue();
}

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

@Override
 public Partition deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException {
  ObjectCodec oc = jsonParser.getCodec();
  JsonNode node = oc.readTree(jsonParser);
  return new Partition(node.getIntValue());
 }
}

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

@Override
 public SystemStreamPartition deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException {
  ObjectCodec oc = jsonParser.getCodec();
  JsonNode node = oc.readTree(jsonParser);
  String system = node.get("system").getTextValue();
  String stream = node.get("stream").getTextValue();
  Partition partition = new Partition(node.get("partition").getIntValue());
  return new SystemStreamPartition(system, stream, partition);
 }
}

代码示例来源:origin: org.apache.samza/samza-core_2.10

@Override
 public SystemStreamPartition deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException {
  ObjectCodec oc = jsonParser.getCodec();
  JsonNode node = oc.readTree(jsonParser);
  String system = node.get("system").getTextValue();
  String stream = node.get("stream").getTextValue();
  Partition partition = new Partition(node.get("partition").getIntValue());
  return new SystemStreamPartition(system, stream, partition);
 }
}

代码示例来源:origin: org.apache.samza/samza-core_2.11

@Override
 public Partition deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException {
  ObjectCodec oc = jsonParser.getCodec();
  JsonNode node = oc.readTree(jsonParser);
  return new Partition(node.getIntValue());
 }
}

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

@Override
 public SystemStreamPartition deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException {
  ObjectCodec oc = jsonParser.getCodec();
  JsonNode node = oc.readTree(jsonParser);
  String system = node.get("system").getTextValue();
  String stream = node.get("stream").getTextValue();
  Partition partition = new Partition(node.get("partition").getIntValue());
  return new SystemStreamPartition(system, stream, partition);
 }
}

相关文章