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

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

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

JsonNode.findPath介绍

[英]Method similar to #findValue, but that will return a "missing node" instead of null if no field is found. Missing node is a specific kind of node for which #isMissingNodereturns true; and all value access methods return empty or missing value.
[中]方法类似于#findValue,但如果未找到字段,则将返回“缺少节点”而不是null。缺失节点是#IsMissingNodeRe为真的特定类型的节点;所有值访问方法都返回空值或缺少值。

代码示例

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

public ReadOnlyJsonNode findPath(final String fieldName)
{
  return wrap(delegate.findPath(fieldName));
}

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

public JsonNode getCounters(JsonNode root) {
 JsonNode counters = root.findPath("counters");
 return counters;
}

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

public JsonNode getGauges(JsonNode root) {
 JsonNode gauges = root.findPath("gauges");
 return gauges;
}

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

public JsonNode getHistograms(JsonNode root) {
 JsonNode histograms = root.findPath("histograms");
 return histograms;
}

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

public JsonNode getMeters(JsonNode root) {
 JsonNode meters = root.findPath("meters");
 return meters;
}

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

public JsonNode getTimers(JsonNode root) {
 JsonNode timers = root.findPath("timers");
 return timers;
}

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

public JsonNode getValue(JsonNode node) {
 return node.findPath("value");
}

代码示例来源:origin: kermitt2/entity-fishing

List<WeightedTerm> terms = new ArrayList<WeightedTerm>();
JsonNode idNode = jsonRoot.findPath("publication_id");
if ((idNode != null) && (!idNode.isMissingNode())) {
  String docid = idNode.getTextValue();
  String outputPath = path + File.separator + docid + ".json";
  JsonNode id = jsonRoot.findPath("_id");
  JsonNode inventionTitle = jsonRoot.findPath("invention_title");
  JsonNode keywordsNode = jsonRoot.findPath("keywords");
      double weight = 0.0;
      JsonNode idNode2 = termNode.findPath("keyword");
      if ((idNode2 != null) && (!idNode2.isMissingNode())) {
        keyword = idNode2.getTextValue();
      idNode2 = termNode.findPath("weight");
      if ((idNode2 != null) && (!idNode2.isMissingNode())) {
        weight = idNode2.getDoubleValue();

代码示例来源:origin: kermitt2/entity-fishing

JsonNode idNode = jsonRoot.findPath("publication_id");
if ((idNode != null) && (!idNode.isMissingNode())) {
  String docid = idNode.getTextValue();
  JsonNode id = jsonRoot.findPath("_id");
  JsonNode inventionTitle = jsonRoot.findPath("invention_title");
  JsonNode keywordsNode = jsonRoot.findPath("keywords");
  JsonNode textNode = jsonRoot.findPath("text"); 
  JsonNode abstractNode = jsonRoot.findPath("abstract"); 
  JsonNode claimsNode = jsonRoot.findPath("claims"); 
  JsonNode descriptionNode = jsonRoot.findPath("description"); 
      JsonNode idNode2 = termNode.findPath("keyword");
      if ((idNode2 != null) && (!idNode2.isMissingNode())) {
        keyword = idNode2.getTextValue();
      idNode2 = termNode.findPath("weight");
      if ((idNode2 != null) && (!idNode2.isMissingNode())) {
        weight = idNode2.getDoubleValue();
      idNode2 = termNode.findPath("status");
      if ((idNode2 != null) && (!idNode2.isMissingNode())) {
        String status = idNode2.getTextValue();
        JsonNode entityNodes = termNode.findPath("entities");
        if ( (entityNodes != null) && (entityNodes.isArray()) ) {
            JsonNode wikiNode = entityNode.findPath("wikipediaExternalRef");

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

public boolean isHA() {
 JsonNode gauges = getGauges(root);
 JsonNode obj = getValue(gauges.findPath(sentryService + ".is_ha"));
 return obj.getValueAsBoolean();
}

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

public boolean isActive() {
  JsonNode gauges = getGauges(root);
  JsonNode obj = getValue(gauges.findPath(sentryService + ".is_active"));
  return obj.getBooleanValue();
 }
}

相关文章