當前位置: 首頁>>代碼示例>>Java>>正文


Java TreeNode.size方法代碼示例

本文整理匯總了Java中com.fasterxml.jackson.core.TreeNode.size方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeNode.size方法的具體用法?Java TreeNode.size怎麽用?Java TreeNode.size使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.fasterxml.jackson.core.TreeNode的用法示例。


在下文中一共展示了TreeNode.size方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: deserialize

import com.fasterxml.jackson.core.TreeNode; //導入方法依賴的package包/類
@Override
public CompoundOperation deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
{
    // Add mapper
    if (jp.getCodec() == null)
        jp.setCodec(new ObjectMapper());

    jp.nextToken();

    // Read whole tree
    TreeNode tree = jp.readValueAsTree();
    Operation[] operations = new Operation[tree.size() - 1];

    // tree.get(0) is always zero

    // Read operations
    for (int i = 1; i < tree.size(); i++) {
        JsonParser ojp = tree.get(i).traverse();
        ojp.setCodec(new ObjectMapper());
        operations[i - 1] = ojp.readValueAs(Operation.class);
    }

    return new CompoundOperation(operations);
}
 
開發者ID:mkrause,項目名稱:gx,代碼行數:25,代碼來源:CompoundOperationDeserializer.java

示例2: compareArrays

import com.fasterxml.jackson.core.TreeNode; //導入方法依賴的package包/類
protected void compareArrays(TreeNode a, TreeNode b) {
    assertThat(a.isArray()).isEqualTo(b.isArray());
    assertThat(a.size()).isEqualTo(b.size());
    for (int i = 0; i < a.size(); i++) {
        assertThat(a.get(i)).isEqualTo(b.get(i));
    }
}
 
開發者ID:javaplugs,項目名稱:mybatis-jackson,代碼行數:8,代碼來源:PostgresqlTest.java

示例3: parse

import com.fasterxml.jackson.core.TreeNode; //導入方法依賴的package包/類
public boolean parse() throws IOException, JsonProcessingException {
    JsonParser parser=factory.createParser(input);
    boolean done=false;
    do {
        TreeNode t=parser.readValueAsTree();
        if(t==null) {
            done=true;
        } else {
            if(t instanceof ObjectNode) {
                if(!documentCompleted((ObjectNode)t))
                    return false;
            } else if(t instanceof ArrayNode) {
                int n=t.size();
                for(int i=0;i<n;i++) {
                    TreeNode elem=t.path(i);
                    if(elem!=null) {
                        if(!documentCompleted((ObjectNode)elem))
                            return false;
                    }
                }
            } else {
                throw new RuntimeException("Ill formed stream");
            }
        }
    } while(!done);
    return true;
}
 
開發者ID:lightblue-platform,項目名稱:lightblue-client,代碼行數:28,代碼來源:StreamJsonParser.java

示例4: isEmpty

import com.fasterxml.jackson.core.TreeNode; //導入方法依賴的package包/類
protected boolean isEmpty(TreeNode node) {
    return node.isContainerNode() && node.size() == 0;
}
 
開發者ID:mc-societies,項目名稱:societies,代碼行數:4,代碼來源:AbstractMapper.java


注:本文中的com.fasterxml.jackson.core.TreeNode.size方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。