Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.ObjectMapper.readTree()


    parts.add(pl.parse(".coll[3]", 1));

    PartsParser pp = new PartsParser(parts);

    ObjectMapper om = new ObjectMapper();
    JsonNode json = om.readTree(content);
    JsonNode root = JsonTree.read(json, pp);
    if(root.isMissingNode()){
      assertEquals(1,1);
    }else{
      fail();
View Full Code Here


    parts.add(pl.parse(".title", 1));

    PartsParser pp = new PartsParser(parts);

    ObjectMapper om = new ObjectMapper();
    JsonNode json = om.readTree(content);
    JsonNode jsonData = om.readTree(data);
    JsonTree.write(json, pp, jsonData.get("data"));
    assertEquals("title2",JsonTree.read(json, pp).asText());
   
   
View Full Code Here

    PartsParser pp = new PartsParser(parts);

    ObjectMapper om = new ObjectMapper();
    JsonNode json = om.readTree(content);
    JsonNode jsonData = om.readTree(data);
    JsonTree.write(json, pp, jsonData.get("data"));
    assertEquals("title2",JsonTree.read(json, pp).asText());
   
   
  }
View Full Code Here

    List<PartsLexer.Part> parts = new ArrayList<PartsLexer.Part>();
    PartsLexer pl = new PartsLexer();
    parts.add(pl.parse(".title2", 1));
    PartsParser pp = new PartsParser(parts);
    ObjectMapper om = new ObjectMapper();
    JsonNode json = om.readTree(content);
    JsonNode jsonData = om.readTree(data);
    JsonTree.write(json, pp, jsonData.get("data"));
    assertEquals("title2",JsonTree.read(json, pp).asText());
  }
 
View Full Code Here

    PartsLexer pl = new PartsLexer();
    parts.add(pl.parse(".title2", 1));
    PartsParser pp = new PartsParser(parts);
    ObjectMapper om = new ObjectMapper();
    JsonNode json = om.readTree(content);
    JsonNode jsonData = om.readTree(data);
    JsonTree.write(json, pp, jsonData.get("data"));
    assertEquals("title2",JsonTree.read(json, pp).asText());
  }
 
  @Test
View Full Code Here

    PartsLexer pl = new PartsLexer();
    parts.add(pl.parse(".title2", 1));
    parts.add(pl.parse(".firstLetter", 2));
    PartsParser pp = new PartsParser(parts);
    ObjectMapper om = new ObjectMapper();
    JsonNode json = om.readTree(content);
    JsonNode jsonData = om.readTree(data);
    try{
      JsonTree.write(json, pp, jsonData.get("data"));
      fail();
    }catch(Exception e){
View Full Code Here

    parts.add(pl.parse(".title2", 1));
    parts.add(pl.parse(".firstLetter", 2));
    PartsParser pp = new PartsParser(parts);
    ObjectMapper om = new ObjectMapper();
    JsonNode json = om.readTree(content);
    JsonNode jsonData = om.readTree(data);
    try{
      JsonTree.write(json, pp, jsonData.get("data"));
      fail();
    }catch(Exception e){
      assertEquals("title2.firstLetter is not a valid path",e.getMessage());
View Full Code Here

    List<PartsLexer.Part> parts = new ArrayList<PartsLexer.Part>();
    PartsLexer pl = new PartsLexer();
    parts.add(pl.parse(".coll[3]", 1));
    PartsParser pp = new PartsParser(parts);
    ObjectMapper om = new ObjectMapper();
    JsonNode json = om.readTree(content);
    JsonNode jsonData = om.readTree(data);
    try{
      JsonTree.write(json, pp, jsonData.get("data"));
      assertEquals(4,JsonTree.read(json, pp).asInt(0));
    }catch(Exception e){
View Full Code Here

    PartsLexer pl = new PartsLexer();
    parts.add(pl.parse(".coll[3]", 1));
    PartsParser pp = new PartsParser(parts);
    ObjectMapper om = new ObjectMapper();
    JsonNode json = om.readTree(content);
    JsonNode jsonData = om.readTree(data);
    try{
      JsonTree.write(json, pp, jsonData.get("data"));
      assertEquals(4,JsonTree.read(json, pp).asInt(0));
    }catch(Exception e){
      fail(e.getMessage());
View Full Code Here

    List<PartsLexer.Part> parts = new ArrayList<PartsLexer.Part>();
    PartsLexer pl = new PartsLexer();
    parts.add(pl.parse(".coll[0]", 1));
    PartsParser pp = new PartsParser(parts);
    ObjectMapper om = new ObjectMapper();
    JsonNode json = om.readTree(content);
    JsonNode jsonData = om.readTree(data);
    try{
      JsonTree.write(json, pp, jsonData.get("data"));
      assertEquals(10,JsonTree.read(json, pp).asInt(0));
     
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.