本文整理了Java中org.codehaus.jackson.JsonNode.path()
方法的一些代码示例,展示了JsonNode.path()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonNode.path()
方法的具体详情如下:
包路径:org.codehaus.jackson.JsonNode
类名称:JsonNode
方法名:path
[英]This method is similar to #get(int), except that instead of returning null if no such element exists (due to index being out of range, or this node not being an array), a "missing node" (node that returns true for #isMissingNode) will be returned. This allows for convenient and safe chained access via path calls.
[中]此方法与#get(int)类似,只是如果不存在此类元素(由于索引超出范围,或者此节点不是数组),则不会返回null,而是返回“缺少的节点”(为#isMissingNode返回true的节点)。这允许通过路径调用进行方便和安全的链接访问。
代码示例来源:origin: org.codehaus.jackson/jackson-core-asl
/**
* Alias of {@link #path(int)}.
*
* @deprecated Use {@link #path(int)} instead
*/
@Deprecated
public final JsonNode getPath(int index) { return path(index); }
代码示例来源:origin: org.codehaus.jackson/jackson-core-asl
/**
* Alias of {@link #path(String)}.
*
* @deprecated Use {@link #path(String)} instead
*/
@Deprecated
public final JsonNode getPath(String fieldName) { return path(fieldName); }
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Alias of {@link #path(String)}.
*
* @deprecated Use {@link #path(String)} instead
*/
@Deprecated
public final JsonNode getPath(String fieldName) { return path(fieldName); }
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Alias of {@link #path(int)}.
*
* @deprecated Use {@link #path(int)} instead
*/
@Deprecated
public final JsonNode getPath(int index) { return path(index); }
代码示例来源:origin: com.barchart.wrap/barchart-wrap-jackson
/**
* Alias of {@link #path(String)}.
*
* @deprecated Use {@link #path(String)} instead
*/
@Deprecated
public final JsonNode getPath(String fieldName) { return path(fieldName); }
代码示例来源:origin: com.barchart.wrap/barchart-wrap-jackson
/**
* Alias of {@link #path(int)}.
*
* @deprecated Use {@link #path(int)} instead
*/
@Deprecated
public final JsonNode getPath(int index) { return path(index); }
代码示例来源:origin: lordofthejars/nosql-unit
private Iterator<JsonNode> dataElements(InputStream dataStream) throws IOException, JsonParseException,
JsonMappingException {
JsonNode rootNode = OBJECT_MAPPER.readValue(dataStream, JsonNode.class);
JsonNode dataNode = rootNode.path(DATA_TOKEN);
Iterator<JsonNode> elements = dataNode.getElements();
return elements;
}
代码示例来源:origin: lordofthejars/nosql-unit
private Iterator<JsonNode> dataElements(InputStream dataStream) throws IOException, JsonParseException,
JsonMappingException {
JsonNode rootNode = OBJECT_MAPPER.readValue(dataStream, JsonNode.class);
JsonNode dataNode = rootNode.path(KeyValueTokens.DATA_TOKEN);
Iterator<JsonNode> elements = dataNode.getElements();
return elements;
}
代码示例来源:origin: lordofthejars/nosql-unit
private JsonNode valueNode(JsonNode element) {
if (element.has(KeyValueTokens.VALUE_TOKEN)) {
return element.path(KeyValueTokens.VALUE_TOKEN);
} else {
throw new IllegalArgumentException("Given dataset does not contain "+KeyValueTokens.VALUE_TOKEN+" token.");
}
}
代码示例来源:origin: org.mule.modules/mule-module-json
public boolean hasNode(String key)
{
JsonNode result = node.path(key);
return result.isMissingNode() == false;
}
代码示例来源:origin: com.lordofthejars/nosqlunit-core
private Iterator<JsonNode> dataElements(InputStream dataStream) throws IOException, JsonParseException,
JsonMappingException {
JsonNode rootNode = OBJECT_MAPPER.readValue(dataStream, JsonNode.class);
JsonNode dataNode = rootNode.path(KeyValueTokens.DATA_TOKEN);
Iterator<JsonNode> elements = dataNode.getElements();
return elements;
}
代码示例来源:origin: com.lordofthejars/nosqlunit-neo4j
private Iterator<JsonNode> dataElements(InputStream dataStream) throws IOException, JsonParseException,
JsonMappingException {
JsonNode rootNode = OBJECT_MAPPER.readValue(dataStream, JsonNode.class);
JsonNode dataNode = rootNode.path(DATA_TOKEN);
Iterator<JsonNode> elements = dataNode.getElements();
return elements;
}
代码示例来源:origin: com.atlassian.jira/jira-core
public ReadOnlyJsonNode path(final String fieldName)
{
return wrap(delegate.path(fieldName));
}
代码示例来源:origin: lordofthejars/nosql-unit
private String implementationKeyClass(JsonNode element) {
String implementationValue = NO_IMPLEMENTATION_PROVIDED;
if (element.has(KeyValueTokens.IMPLEMENTATION_KEY_TOKEN)) {
implementationValue = element.path(KeyValueTokens.IMPLEMENTATION_KEY_TOKEN).getTextValue();
}
return implementationValue.trim();
}
代码示例来源:origin: lordofthejars/nosql-unit
private String implementationClass(JsonNode element) {
String implementationValue = NO_IMPLEMENTATION_PROVIDED;
if (element.has(KeyValueTokens.IMPLEMENTATION_TOKEN)) {
implementationValue = element.path(KeyValueTokens.IMPLEMENTATION_TOKEN).getTextValue();
}
return implementationValue.trim();
}
代码示例来源:origin: com.moz.fiji.schema/fiji-schema
/** {@inheritDoc} */
@Override
public FijiRowFilter createFromJson(JsonNode rootNode) {
float chance = (float) rootNode.path(CHANCE_NODE).getValueAsDouble();
return new FijiRandomRowFilter(chance);
}
}
代码示例来源:origin: lordofthejars/nosql-unit
private Object keyValue(JsonNode element) throws JsonParseException, JsonMappingException, IOException, ClassNotFoundException {
Object keyValue;
if (element.has(KeyValueTokens.KEY_TOKEN)) {
String implementationKey = implementationKeyClass(element);
keyValue = readElement(element.path(KeyValueTokens.KEY_TOKEN), implementationKey);
} else {
throw new IllegalArgumentException("Given dataset does not contain "+KeyValueTokens.KEY_TOKEN+" token.");
}
return keyValue;
}
代码示例来源:origin: com.lordofthejars/nosqlunit-core
private Object keyValue(JsonNode element) throws JsonParseException, JsonMappingException, IOException, ClassNotFoundException {
Object keyValue;
if (element.has(KeyValueTokens.KEY_TOKEN)) {
String implementationKey = implementationKeyClass(element);
keyValue = readElement(element.path(KeyValueTokens.KEY_TOKEN), implementationKey);
} else {
throw new IllegalArgumentException("Given dataset does not contain "+KeyValueTokens.KEY_TOKEN+" token.");
}
return keyValue;
}
代码示例来源:origin: rdelbru/SIREn
@Override
Float parse() throws ParseException {
final JsonNode value = node.path(BOOST_PROPERTY);
if (value.isFloatingPointNumber()) {
return (float) value.asDouble();
}
throw new ParseException("Invalid property '" + BOOST_PROPERTY + "': value is not a float");
}
代码示例来源:origin: rdelbru/SIREn
private void convertLatitude(final JsonNode obj) {
final ObjectNode node = (ObjectNode) obj.path("ChargeDeviceLocation");
final JsonNode current = node.path("Latitude");
if (!current.isMissingNode() && !current.isNull()) {
final double value = Double.parseDouble(current.asText());
node.put("Latitude", value);
}
if (current.isNull()) {
node.remove("Latitude");
}
}
内容来源于网络,如有侵权,请联系作者删除!