Package com.fasterxml.jackson.databind.node

Examples of com.fasterxml.jackson.databind.node.JsonNodeFactory.arrayNode()


        }
       
        private ArrayNode flattenResults()
        {
            final JsonNodeFactory factory = JsonNodeFactory.instance;
            ArrayNode flatArray = factory.arrayNode();
            for (Map.Entry<Integer,ArrayNode> entry : results.entrySet())
            {
                flatArray.addAll(entry.getValue());
            }
            return flatArray;
View Full Code Here


    JsonNodeFactory factory = new JsonNodeFactory(false);

    assertEquals(Arrays.asList(10), collector.getFirstRecord().get("/docId"));
    assertEquals(Arrays.asList(rootNode.get("links")), collector.getFirstRecord().get("/links"));
   
    assertEquals(Arrays.asList(factory.arrayNode()), collector.getFirstRecord().get("/links/backward"));
    assertEquals(factory.arrayNode(), rootNode.get("links").get("backward"));
   
    List expected = Arrays.asList(factory.arrayNode().add(20).add(40).add(60).add(true).add(false).add(32767).add(2147483647).add(9223372036854775807L).add(1.23).add(1.7976931348623157E308));
    assertEquals(expected, collector.getFirstRecord().get("/links/forward"));
    assertEquals(expected, collector.getFirstRecord().get("/links/forward/[]"));
View Full Code Here

    assertEquals(Arrays.asList(10), collector.getFirstRecord().get("/docId"));
    assertEquals(Arrays.asList(rootNode.get("links")), collector.getFirstRecord().get("/links"));
   
    assertEquals(Arrays.asList(factory.arrayNode()), collector.getFirstRecord().get("/links/backward"));
    assertEquals(factory.arrayNode(), rootNode.get("links").get("backward"));
   
    List expected = Arrays.asList(factory.arrayNode().add(20).add(40).add(60).add(true).add(false).add(32767).add(2147483647).add(9223372036854775807L).add(1.23).add(1.7976931348623157E308));
    assertEquals(expected, collector.getFirstRecord().get("/links/forward"));
    assertEquals(expected, collector.getFirstRecord().get("/links/forward/[]"));
    assertEquals(expected, collector.getFirstRecord().get("/links/forward[]"));
View Full Code Here

    assertEquals(Arrays.asList(rootNode.get("links")), collector.getFirstRecord().get("/links"));
   
    assertEquals(Arrays.asList(factory.arrayNode()), collector.getFirstRecord().get("/links/backward"));
    assertEquals(factory.arrayNode(), rootNode.get("links").get("backward"));
   
    List expected = Arrays.asList(factory.arrayNode().add(20).add(40).add(60).add(true).add(false).add(32767).add(2147483647).add(9223372036854775807L).add(1.23).add(1.7976931348623157E308));
    assertEquals(expected, collector.getFirstRecord().get("/links/forward"));
    assertEquals(expected, collector.getFirstRecord().get("/links/forward/[]"));
    assertEquals(expected, collector.getFirstRecord().get("/links/forward[]"));
    assertEquals(Arrays.asList(rootNode.get("name")), collector.getFirstRecord().get("/name"));
    assertEquals(Arrays.asList("en-us", "en", "en-gb"), collector.getFirstRecord().get("/name/[]/language/[]/code"));
View Full Code Here

    JsonNodeFactory factory = new JsonNodeFactory(false);

    assertEquals(Arrays.asList(10), collector.getFirstRecord().get("/docId"));
    assertEquals(Arrays.asList(rootNode.get("links")), collector.getFirstRecord().get("/links"));
   
    assertEquals(Arrays.asList(factory.arrayNode()), collector.getFirstRecord().get("/links/backward"));
    assertEquals(factory.arrayNode(), rootNode.get("links").get("backward"));
   
    List expected = Arrays.asList(factory.arrayNode().add(20).add(40).add(60).add(true).add(false).add(32767).add(2147483647).add(9223372036854775807L).add(1.23).add(1.7976931348623157E308));
    assertEquals(expected, collector.getFirstRecord().get("/links/forward"));
    assertEquals(expected, collector.getFirstRecord().get("/links/forward/[]"));
View Full Code Here

    assertEquals(Arrays.asList(10), collector.getFirstRecord().get("/docId"));
    assertEquals(Arrays.asList(rootNode.get("links")), collector.getFirstRecord().get("/links"));
   
    assertEquals(Arrays.asList(factory.arrayNode()), collector.getFirstRecord().get("/links/backward"));
    assertEquals(factory.arrayNode(), rootNode.get("links").get("backward"));
   
    List expected = Arrays.asList(factory.arrayNode().add(20).add(40).add(60).add(true).add(false).add(32767).add(2147483647).add(9223372036854775807L).add(1.23).add(1.7976931348623157E308));
    assertEquals(expected, collector.getFirstRecord().get("/links/forward"));
    assertEquals(expected, collector.getFirstRecord().get("/links/forward/[]"));
    assertEquals(expected, collector.getFirstRecord().get("/links/forward[]"));
View Full Code Here

    assertEquals(Arrays.asList(rootNode.get("links")), collector.getFirstRecord().get("/links"));
   
    assertEquals(Arrays.asList(factory.arrayNode()), collector.getFirstRecord().get("/links/backward"));
    assertEquals(factory.arrayNode(), rootNode.get("links").get("backward"));
   
    List expected = Arrays.asList(factory.arrayNode().add(20).add(40).add(60).add(true).add(false).add(32767).add(2147483647).add(9223372036854775807L).add(1.23).add(1.7976931348623157E308));
    assertEquals(expected, collector.getFirstRecord().get("/links/forward"));
    assertEquals(expected, collector.getFirstRecord().get("/links/forward/[]"));
    assertEquals(expected, collector.getFirstRecord().get("/links/forward[]"));
    assertEquals(Arrays.asList(rootNode.get("name")), collector.getFirstRecord().get("/name"));
    assertEquals(Arrays.asList("en-us", "en", "en-gb"), collector.getFirstRecord().get("/name/[]/language/[]/code"));
View Full Code Here

            throw new IllegalArgumentException("Must have file with .csv, .tsv or .json suffix");
        }

        List<String> names = Lists.newArrayList(splitter.split(lines.get(0)));
        JsonNodeFactory nf = JsonNodeFactory.withExactBigDecimals(false);
        ArrayNode localData = nf.arrayNode();
        for (String line : lines.subList(1, lines.size())) {
            ObjectNode r = nf.objectNode();
            List<String> fields = Lists.newArrayList(splitter.split(line));
            Preconditions.checkState(names.size() == fields.size(), "Wrong number of fields, expected ", names.size(), fields.size());
            Iterator<String> ix = names.iterator();
View Full Code Here

        }
       
        private ArrayNode flattenResults()
        {
            final JsonNodeFactory factory = JsonNodeFactory.instance;
            ArrayNode flatArray = factory.arrayNode();
            for (Map.Entry<Integer,ArrayNode> entry : results.entrySet())
            {
                flatArray.addAll(entry.getValue());
            }
            return flatArray;
View Full Code Here

                {
                    jsonArray = resultMap.get(phase);
                }
                else
                {
                    jsonArray = factory.arrayNode();
                    resultMap.put(phase, jsonArray);
                }
               
                JsonNode responseJson;
                try
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.