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

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

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

JsonNode.findParent介绍

[英]Method for finding a JSON Object that contains specified field, within this node or its descendants. If no matching field is found in this node or its descendants, returns null.
[中]方法,用于在此节点或其子节点内查找包含指定字段的JSON对象。如果在此节点或其子节点中未找到匹配字段,则返回null。

代码示例

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

@Override
public ObjectNode findParent(String fieldName)
{
  for (JsonNode node : _children) {
    JsonNode parent = node.findParent(fieldName);
    if (parent != null) {
      return (ObjectNode) parent;
    }
  }
  return null;
}

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

@Override
public ObjectNode findParent(String fieldName)
{
  for (Map.Entry<String, JsonNode> entry : _children.entrySet()) {
    if (fieldName.equals(entry.getKey())) {
      return this;
    }
    JsonNode value = entry.getValue().findParent(fieldName);
    if (value != null) {
      return (ObjectNode) value;
    }
  }
  return null;
}

代码示例来源:origin: liferay/liferay-portal

/**
 * Parses the given JsonNode which is a <code>@context</code> node and find
 * the type coercion terms.
 *
 * @param  contextJsonNode
 * @return the name of the type coercion term keys otherwise empty
 *         <code>List<String></code>
 * @review
 */
public static List<String> getTypeCoercionTermKeys(
  JsonNode contextJsonNode) {
  List<String> typeCoercionTermKeys = new ArrayList<>();
  for (JsonNode jsonNode : contextJsonNode) {
    if (jsonNode.isObject()) {
      JsonNode typeObjectJsonNode = jsonNode.findParent(
        JSONLDConstants.TYPE);
      if (typeObjectJsonNode != null) {
        JsonNode typeJsonNode = typeObjectJsonNode.path(
          JSONLDConstants.TYPE);
        if (JSONLDConstants.ID.equals(typeJsonNode.asText())) {
          Iterator<String> it = jsonNode.fieldNames();
          while (it.hasNext()) {
            typeCoercionTermKeys.add(it.next());
          }
        }
      }
    }
  }
  return typeCoercionTermKeys;
}

代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all

@Override
public ObjectNode findParent(String fieldName)
{
  for (JsonNode node : _children) {
    JsonNode parent = node.findParent(fieldName);
    if (parent != null) {
      return (ObjectNode) parent;
    }
  }
  return null;
}

代码示例来源:origin: com.jwebmp.jackson.core/jackson-databind

@Override
public ObjectNode findParent(String fieldName)
{
  for (JsonNode node : _children) {
    JsonNode parent = node.findParent(fieldName);
    if (parent != null) {
      return (ObjectNode) parent;
    }
  }
  return null;
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

@Override
public ObjectNode findParent(String fieldName)
{
  for (JsonNode node : _children) {
    JsonNode parent = node.findParent(fieldName);
    if (parent != null) {
      return (ObjectNode) parent;
    }
  }
  return null;
}

代码示例来源:origin: Nextdoor/bender

@Override
public ObjectNode findParent(String fieldName)
{
  for (JsonNode node : _children) {
    JsonNode parent = node.findParent(fieldName);
    if (parent != null) {
      return (ObjectNode) parent;
    }
  }
  return null;
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
public ObjectNode findParent(String fieldName)
{
  if (_children != null) {
    for (JsonNode node : _children) {
      JsonNode parent = node.findParent(fieldName);
      if (parent != null) {
        return (ObjectNode) parent;
      }
    }
  }
  return null;        
}

代码示例来源:origin: com.fasterxml.jackson.core/com.springsource.com.fasterxml.jackson.core.jackson-databind

@Override
public ObjectNode findParent(String fieldName)
{
  if (_children != null) {
    for (JsonNode node : _children) {
      JsonNode parent = node.findParent(fieldName);
      if (parent != null) {
        return (ObjectNode) parent;
      }
    }
  }
  return null;        
}

代码示例来源:origin: Nextdoor/bender

@Override
public ObjectNode findParent(String fieldName)
{
  for (Map.Entry<String, JsonNode> entry : _children.entrySet()) {
    if (fieldName.equals(entry.getKey())) {
      return this;
    }
    JsonNode value = entry.getValue().findParent(fieldName);
    if (value != null) {
      return (ObjectNode) value;
    }
  }
  return null;
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

@Override
public ObjectNode findParent(String fieldName)
{
  for (Map.Entry<String, JsonNode> entry : _children.entrySet()) {
    if (fieldName.equals(entry.getKey())) {
      return this;
    }
    JsonNode value = entry.getValue().findParent(fieldName);
    if (value != null) {
      return (ObjectNode) value;
    }
  }
  return null;
}

代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all

@Override
public ObjectNode findParent(String fieldName)
{
  for (Map.Entry<String, JsonNode> entry : _children.entrySet()) {
    if (fieldName.equals(entry.getKey())) {
      return this;
    }
    JsonNode value = entry.getValue().findParent(fieldName);
    if (value != null) {
      return (ObjectNode) value;
    }
  }
  return null;
}

代码示例来源:origin: com.jwebmp.jackson.core/jackson-databind

@Override
public ObjectNode findParent(String fieldName)
{
  for (Map.Entry<String, JsonNode> entry : _children.entrySet()) {
    if (fieldName.equals(entry.getKey())) {
      return this;
    }
    JsonNode value = entry.getValue().findParent(fieldName);
    if (value != null) {
      return (ObjectNode) value;
    }
  }
  return null;
}

代码示例来源:origin: com.fasterxml.jackson.core/com.springsource.com.fasterxml.jackson.core.jackson-databind

@Override
public ObjectNode findParent(String fieldName)
{
  if (_children != null) {
    for (Map.Entry<String, JsonNode> entry : _children.entrySet()) {
      if (fieldName.equals(entry.getKey())) {
        return this;
      }
      JsonNode value = entry.getValue().findParent(fieldName);
      if (value != null) {
        return (ObjectNode) value;
      }
    }
  }
  return null;
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
public ObjectNode findParent(String fieldName)
{
  if (_children != null) {
    for (Map.Entry<String, JsonNode> entry : _children.entrySet()) {
      if (fieldName.equals(entry.getKey())) {
        return this;
      }
      JsonNode value = entry.getValue().findParent(fieldName);
      if (value != null) {
        return (ObjectNode) value;
      }
    }
  }
  return null;
}

代码示例来源:origin: com.unboundid.product.scim2/scim2-sdk-common

/**
 * {@inheritDoc}
 */
@Override
public ObjectNode findParent(final String fieldName)
{
 for (Map.Entry<String, JsonNode> entry : _children.entrySet())
 {
  if (toLowerCase(fieldName).equals(toLowerCase(entry.getKey())))
  {
   return this;
  }
  JsonNode value = entry.getValue().findParent(fieldName);
  if (value != null)
  {
   return (ObjectNode) value;
  }
 }
 return null;
}

代码示例来源:origin: pingidentity/scim2

/**
 * {@inheritDoc}
 */
@Override
public ObjectNode findParent(final String fieldName)
{
 for (Map.Entry<String, JsonNode> entry : _children.entrySet())
 {
  if (toLowerCase(fieldName).equals(toLowerCase(entry.getKey())))
  {
   return this;
  }
  JsonNode value = entry.getValue().findParent(fieldName);
  if (value != null)
  {
   return (ObjectNode) value;
  }
 }
 return null;
}

代码示例来源:origin: com.redhat.lightblue/util

continue;
} else if (name.equals(Path.PARENT)) {
  output = node.findParent(p.head(findNextNonRealtiveSegment(p, l)));
  continue;
} else if (output instanceof ArrayNode) {

代码示例来源:origin: marklogic/java-client-api

JSONAssert.assertEquals(expAftrPut, jh.get().get("document-content").findParent("array").toString(), false);
JSONAssert.assertEquals(expectedResponse, tjs.deleteJSON("helloJS" + j + ".json"), false);

相关文章