当前位置: 首页>>代码示例>>Java>>正文


Java ContainerNode类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:lightblue-platform,项目名称:lightblue-migrator,代码行数:18,代码来源:DefaultMigrator.java

示例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;
}
 
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:25,代码来源:JsonDoc.java

示例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);
}
 
开发者ID:shairontoledo,项目名称:cloudstatus,代码行数:9,代码来源:TestHttpRequest.java

示例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();
        }
    }
}
 
开发者ID:glowroot,项目名称:glowroot,代码行数:12,代码来源:ObjectMappers.java

示例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);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-ldap,代码行数:12,代码来源:ResultTranslatorToJson.java

示例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();
    }
}
 
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:35,代码来源:TranslatorToJson.java

示例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;

}
 
开发者ID:DDTH,项目名称:ddth-commons,代码行数:13,代码来源:DPathUtils.java

示例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));
}
 
开发者ID:shairontoledo,项目名称:cloudstatus,代码行数:4,代码来源:TestHttpRequest.java

示例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));
}
 
开发者ID:shairontoledo,项目名称:cloudstatus,代码行数:4,代码来源:TestHttpRequest.java

示例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);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-client,代码行数:7,代码来源:Projection.java

示例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);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-client,代码行数:7,代码来源:Projection.java

示例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);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-client,代码行数:7,代码来源:Update.java

示例14: update

import com.fasterxml.jackson.databind.node.ContainerNode; //导入依赖的package包/类
public static Update update(ContainerNode node) {
    return new Update(node);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-client,代码行数:4,代码来源:Update.java

示例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);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-client,代码行数:7,代码来源:Query.java


注:本文中的com.fasterxml.jackson.databind.node.ContainerNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。