本文整理汇总了Java中com.fasterxml.jackson.databind.node.ContainerNode类的典型用法代码示例。如果您正苦于以下问题:Java ContainerNode类的具体用法?Java ContainerNode怎么用?Java ContainerNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContainerNode类属于com.fasterxml.jackson.databind.node包,在下文中一共展示了ContainerNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSourceDocuments
import com.fasterxml.jackson.databind.node.ContainerNode; //导入依赖的package包/类
@Override
public List<JsonNode> getSourceDocuments() {
LOGGER.debug("Retrieving source docs");
try {
DataFindRequest sourceRequest = new DataFindRequest(getMigrationConfiguration().getSourceEntityName(),
getMigrationConfiguration().getSourceEntityVersion());
sourceRequest.where(Query.query((ContainerNode) JSON.toJsonNode(getMigrationJob().getQuery())));
sourceRequest.select(Projection.includeFieldRecursively("*"), Projection.excludeField("objectType"));
LOGGER.debug("Source docs retrieval req: {}", sourceRequest.getBody());
JsonNode[] results = getSourceCli().data(sourceRequest, JsonNode[].class);
LOGGER.debug("There are {} source docs", results.length);
return Arrays.asList(results);
} catch (Exception e) {
LOGGER.error("Error while retrieving source documents:{}", e);
throw new RuntimeException("Cannot retrieve source documents:" + e);
}
}
示例2: appendToJsonNode
import com.fasterxml.jackson.databind.node.ContainerNode; //导入依赖的package包/类
@Override
protected void appendToJsonNode(Object value, ContainerNode<?> targetNode, FieldCursor cursor) {
FieldTreeNode field = cursor.getCurrentNode();
if(PredefinedFields.isFieldAnArrayCount(field.getName(), currentFields)){
/*
* This case will be handled by the array itself, allowing this to
* process runs the risk of nulling out the correct value.
*/
return;
}
Path fieldPath = cursor.getCurrentPath();
if (targetNode instanceof ObjectNode) {
currentTargetObjectNode = (ObjectNode) targetNode;
}
if(PredefinedFields.isFieldObjectType(fieldPath.toString())){
((ObjectNode) targetNode).set(fieldPath.toString(), toJson(StringType.TYPE, entityMetadata.getEntityInfo().getName()));
}
else{
super.appendToJsonNode(value, targetNode, cursor);
}
}
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:26,代码来源:NonPersistedPredefinedFieldTranslatorToJson.java
示例3: findParent
import com.fasterxml.jackson.databind.node.ContainerNode; //导入依赖的package包/类
/**
* This method here expands our horizons in writing code that sucks.
* JsonNodes have no parent pointer, so finding a parent involves iterating
* all nodes with the hope of finding the node, and returning the container
* that contains it.
*
* The whole JsonNode thing should be reengineered at some point.
*/
public static JsonNode findParent(final JsonNode root, final JsonNode node) {
if (root instanceof ContainerNode) {
for (Iterator<JsonNode> itr = root.elements(); itr.hasNext();) {
JsonNode child = itr.next();
if (child == node) {
return root;
} else {
JsonNode found = findParent(child, node);
if (found != null) {
return found;
}
}
}
}
return null;
}
示例4: withDataRequest
import com.fasterxml.jackson.databind.node.ContainerNode; //导入依赖的package包/类
private TestRackInterface withDataRequest(String resource, ContainerNode<ObjectNode> body, MockHttpServletRequestBuilder requestBuilder) throws Exception {
MvcResult result = getMockMvc().perform(requestBuilder
.content(body.toString())
.contentType(contentType))
.andReturn();
return toSimpleResponse(result);
}
示例5: stripEmptyContainerNodes
import com.fasterxml.jackson.databind.node.ContainerNode; //导入依赖的package包/类
public static void stripEmptyContainerNodes(ObjectNode objectNode) {
Iterator<Entry<String, JsonNode>> i = objectNode.fields();
while (i.hasNext()) {
Entry<String, JsonNode> entry = i.next();
JsonNode value = entry.getValue();
if (value instanceof ContainerNode && ((ContainerNode<?>) value).size() == 0) {
// remove empty nodes, e.g. unused "smtp" and "alerts" nodes
i.remove();
}
}
}
示例6: appendToJsonNode
import com.fasterxml.jackson.databind.node.ContainerNode; //导入依赖的package包/类
@Override
protected void appendToJsonNode(Object value, ContainerNode<?> targetNode, FieldCursor cursor) {
Path fieldPath = cursor.getCurrentPath();
if(dnPath.equals(fieldPath)){
//DN is not technically an attribute and can be skipped.
return;
}
super.appendToJsonNode(value, targetNode, cursor);
}
示例7: appendToJsonNode
import com.fasterxml.jackson.databind.node.ContainerNode; //导入依赖的package包/类
protected void appendToJsonNode(Object value, ContainerNode<?> targetNode, FieldCursor cursor) {
FieldTreeNode field = cursor.getCurrentNode();
Error.push(field.getName());
try{
JsonNode newJsonNode = null;
Object newValue = null;
if (field instanceof ObjectField || field instanceof ObjectArrayElement) {
newJsonNode = translateToObjectNode(value, cursor);
}
else if((newValue = getValueFor(value, cursor.getCurrentPath())) != null){
if (field instanceof SimpleField) {
newJsonNode = translate((SimpleField)field, newValue);
}
else if (field instanceof ArrayField){
newJsonNode = translateToArrayNode((ArrayField) field, newValue, cursor);
}
else{
throw new UnsupportedOperationException("Unknown Field type: " + field.getClass().getName());
}
}
if (targetNode instanceof ObjectNode) {
((ObjectNode) targetNode).set(cursor.getCurrentNode().getName(), newJsonNode);
}
else {
((ArrayNode) targetNode).add(newJsonNode);
}
}
finally{
Error.pop();
}
}
示例8: createIntermediate
import com.fasterxml.jackson.databind.node.ContainerNode; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
private static JsonNode createIntermediate(JsonNode node, StringBuffer pathSofar, String index,
String nextIndex) {
if (node instanceof ContainerNode) {
ContainerNode temp = (ContainerNode) node;
JsonNode value = PATTERN_INDEX.matcher(nextIndex).matches() ? temp.arrayNode()
: temp.objectNode();
return createIntermediate(temp, pathSofar, index, value);
}
return null;
}
示例9: POST
import com.fasterxml.jackson.databind.node.ContainerNode; //导入依赖的package包/类
public TestRackInterface POST(String resource, ContainerNode<ObjectNode> body) throws Exception {
return withDataRequest(resource, body, post(resource));
}
示例10: PUT
import com.fasterxml.jackson.databind.node.ContainerNode; //导入依赖的package包/类
public TestRackInterface PUT(String resource, ContainerNode<ObjectNode> body) throws Exception {
return withDataRequest(resource, body, put(resource));
}
示例11: Projection
import com.fasterxml.jackson.databind.node.ContainerNode; //导入依赖的package包/类
/**
* Constructs a projection node from an array or object node
*/
public Projection(ContainerNode node) {
super(node);
}
示例12: project
import com.fasterxml.jackson.databind.node.ContainerNode; //导入依赖的package包/类
/**
* Returns a projection based on an array or object node
*/
public static Projection project(ContainerNode node) {
return new Projection(node);
}
示例13: Update
import com.fasterxml.jackson.databind.node.ContainerNode; //导入依赖的package包/类
/**
* Creates an update node with the given array or object node
*/
public Update(ContainerNode node) {
super(node);
}
示例14: update
import com.fasterxml.jackson.databind.node.ContainerNode; //导入依赖的package包/类
public static Update update(ContainerNode node) {
return new Update(node);
}
示例15: Query
import com.fasterxml.jackson.databind.node.ContainerNode; //导入依赖的package包/类
/**
* Constructs a query object from a json array or object
*/
public Query(ContainerNode node) {
super(node);
}