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

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

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

JsonNode.isValueNode介绍

[英]Method that returns true for all value nodes: ones that are not containers, and that do not represent "missing" nodes in the path. Such value nodes represent String, Number, Boolean and null values from JSON.

Note: one and only one of methods #isValueNode, #isContainerNode and #isMissingNode ever returns true for any given node.
[中]方法,该方法为所有值节点返回true:这些节点不是容器,并且不表示路径中的“缺失”节点。这些值节点表示JSON中的字符串、数字、布尔值和空值。
注意:对于任何给定节点,方法#isValueNode、#isContainerNode和#isMissingNode中只有一个会返回true。

代码示例

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

/**
 * Node is a value (nb: could be {@link #isNull() null}).
 */
public boolean isValue() {
  return jsonNode.isValueNode();
}

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

/**
 * Node is a value (nb: could be {@link #isNull() null}).
 */
public boolean isValue() {
  return jsonNode.isValueNode();
}

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

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

代码示例来源:origin: com.github.foodev/jsondiff

@Override
public boolean isJsonPrimitive() {
  return wrapped.isValueNode();
}

代码示例来源:origin: algesten/jsondiff

@Override
public boolean isJsonPrimitive() {
  return wrapped.isValueNode();
}

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

private static void checkValue(final String path, final JsonNode node, final String requiredType) {
  if (node.isValueNode()) {
    return;
  }
  throw new IllegalArgumentException(formatExMsg(path, "is not " + requiredType));
}

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

private static void checkValue(final String path, final JsonNode node, final String requiredType) {
  if (node.isValueNode()) {
    return;
  }
  throw new IllegalArgumentException(formatExMsg(path, "is not " + requiredType));
}

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

private JsonNode findBy(String key, String value) {
  Iterator<JsonNode> nodes = root.get("data").getElements();
  while(nodes.hasNext()) {
    JsonNode node = nodes.next();
    if ((null != node.get(key)) && (node.get(key).isValueNode())) {
      final String valueNode = node.get(key).getTextValue();
      if (valueNode.equals(value)) {
        return node;
      }
    }
  }
  return null;
}

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

private JsonNode findBy(String key, String value) {
    Iterator<JsonNode> nodes = root.get("data").getElements();
    while(nodes.hasNext()) {
      JsonNode node = nodes.next();
      if ((null != node.get(key)) && (node.get(key).isValueNode())) {
        final String valueNode = node.get(key).getTextValue();
        if (valueNode.equals(value)) {
          return node;
        }
      }
    }
    return null;
  }
}

代码示例来源:origin: jhpoelen/eol-globi-data

public static List<Column> columnsForSchema(JsonNode table, JsonNode tableSchema, Dataset dataset) throws IOException {
  return tableSchema.isValueNode() ?
      columnsFromExternalSchema(tableSchema, dataset) :
      columnNamesForMetaTable(table);
}

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

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

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

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

代码示例来源:origin: org.mule.modules/mule-module-json

public String getAsString(String expression)
{
  JsonNode node = get(expression);
  if (node.isValueNode())
  {
    return node.asText();
  }
  else
  {
    return node.toString();
  }
}

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

private JsonRepresentation getMap(final String path, final JsonNode node) {
  if (representsNull(node)) {
    return null;
  }
  if (isArray(node) || node.isValueNode()) {
    throw new IllegalArgumentException(formatExMsg(path, "is not a map"));
  }
  return new JsonRepresentation(node);
}

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

private JsonRepresentation getMap(final String path, final JsonNode node) {
  if (representsNull(node)) {
    return null;
  }
  if (isArray(node) || node.isValueNode()) {
    throw new IllegalArgumentException(formatExMsg(path, "is not a map"));
  }
  return new JsonRepresentation(node);
}

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

public boolean isLink(final JsonNode node) {
  if (representsNull(node) || isArray(node) || node.isValueNode()) {
    return false;
  }
  final LinkRepresentation link = new LinkRepresentation(node);
  if (link.getHref() == null) {
    return false;
  }
  return true;
}

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

public boolean isLink(final JsonNode node) {
  if (representsNull(node) || isArray(node) || node.isValueNode()) {
    return false;
  }
  final LinkRepresentation link = new LinkRepresentation(node);
  if (link.getHref() == null) {
    return false;
  }
  return true;
}

代码示例来源:origin: CESNET/perun

@Override
public String readString(String name) throws RpcException {
  JsonNode node = root.get(name);
  if (node == null) {
    throw new RpcException(RpcException.Type.MISSING_VALUE, name);
  }
  if (node.isNull()) {
    return null;
  }
  if (!node.isValueNode()) {
    throw new RpcException(RpcException.Type.CANNOT_DESERIALIZE_VALUE, node.toString() + " as String");
  }
  return node.asText();
}

代码示例来源:origin: com.github.foodev/jsondiff

public static JzonElement wrap(JsonNode el) {
  if (el == null || el.isNull()) {
    return JacksonJsonNull.INSTANCE;
  } else if (el.isArray()) {
    return new JacksonJsonArray((ArrayNode) el);
  } else if (el.isObject()) {
    return new JacksonJsonObject((ObjectNode) el);
  } else if (el.isValueNode()) {
    return new JacksonJsonPrimitive((ValueNode) el);
  } else {
    throw new IllegalStateException();
  }
}

代码示例来源: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()));
}

相关文章