本文整理了Java中org.codehaus.jackson.JsonNode.isContainerNode()
方法的一些代码示例,展示了JsonNode.isContainerNode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonNode.isContainerNode()
方法的具体详情如下:
包路径:org.codehaus.jackson.JsonNode
类名称:JsonNode
方法名:isContainerNode
[英]Method that returns true for container nodes: Arrays and Objects.
Note: one and only one of methods #isValueNode, #isContainerNode and #isMissingNode ever returns true for any given node.
[中]方法,该方法为容器节点(数组和对象)返回true。
注意:对于任何给定节点,方法#isValueNode、#isContainerNode和#isMissingNode中只有一个会返回true。
代码示例来源:origin: kaaproject/kaa
/**
* Change encoding of uuids from <b>latin1 (ISO-8859-1)</b> to <b>base64</b>.
*
* @param json the json that should be processed
* @return the json with changed uuids
* @throws IOException the io exception
*/
public static JsonNode encodeUuids(JsonNode json) throws IOException {
if (json.has(UUID_FIELD)) {
JsonNode jsonNode = json.get(UUID_FIELD);
if (jsonNode.has(UUID_VALUE)) {
String value = jsonNode.get(UUID_VALUE).asText();
String encodedValue = Base64.getEncoder().encodeToString(value.getBytes("ISO-8859-1"));
((ObjectNode) jsonNode).put(UUID_VALUE, encodedValue);
}
}
for (JsonNode node : json) {
if (node.isContainerNode()) {
encodeUuids(node);
}
}
return json;
}
代码示例来源:origin: kaaproject/kaa
/**
* Removes UUIDs from a json tree.
*
* @param json json tree node
*/
public static void removeUuids(JsonNode json) {
boolean containerWithId = json.isContainerNode() && json.has(UUID_FIELD);
boolean isArray = json.isArray();
boolean childIsNotArray = !(json.size() == 1 && json.getElements().next().isArray());
if (containerWithId && !isArray && childIsNotArray) {
((ObjectNode) json).remove(UUID_FIELD);
}
for (JsonNode node : json) {
if (node.isContainerNode()) {
removeUuids(node);
}
}
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
public boolean isContainerNode()
{
return delegate.isContainerNode();
}
代码示例来源:origin: sentilo/sentilo
private static Map<String, Object> extractMeasuresFromComplexType(final String parentMeasureName, final JsonNode jsonNode) {
final Map<String, Object> unwrappedValues = new HashMap<String, Object>();
if (jsonNode.isContainerNode()) {
final Iterator<Entry<String, JsonNode>> i = jsonNode.getFields();
while (i.hasNext()) {
final Entry<String, JsonNode> childEntry = i.next();
unwrappedValues.putAll(extractMeasuresFromComplexType(parentMeasureName + "." + childEntry.getKey(), childEntry.getValue()));
}
} else {
final String measureName = parentMeasureName;
try {
final Object value = getSimpleValue(jsonNode.asText());
unwrappedValues.put(measureName, value);
} catch (final ParseException pe) {
// probably String or some non-numeric value. Pass
}
}
return unwrappedValues;
}
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.crowdflower
String currentKey = elt.getKey();
if(currentNode.isContainerNode())
内容来源于网络,如有侵权,请联系作者删除!