Examples of readTree()


Examples of com.fasterxml.jackson.core.ObjectCodec.readTree()

    @Override
    public Link deserialize(JsonParser jsonParser,
                            DeserializationContext deserializationContext) throws IOException, JsonProcessingException {

        ObjectCodec oc = jsonParser.getCodec();
        JsonNode node = oc.readTree(jsonParser);
        String rel = node.fieldNames().next();
        String href = node.elements().next().get("href").textValue();


        return new Link(rel,href);
View Full Code Here

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

    private JsonNode buildTree_and_getRoot_fromContent(String jsonContent){
        JsonNode node = null;
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            node = objectMapper.readTree(jsonContent);
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
        return node;
View Full Code Here

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

            String jsonContent = "";
            BufferedReader reader = new BufferedReader(new FileReader(jsonFile));
            String line;
            while((line = reader.readLine()) != null) jsonContent += line;
            reader.close();
            node = objectMapper.readTree(jsonContent);
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
        return node;
View Full Code Here

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

    public AbsoluteRange getHistogramBoundaries() {
        if (boundaries == null) {
            try {
                ObjectMapper mapper = new ObjectMapper();
                JsonParser jp = mapper.getFactory().createParser(getBuiltQuery());
                JsonNode rootNode = mapper.readTree(jp);
                JsonNode timestampNode = rootNode.findValue("range").findValue("timestamp");
                String from = Tools.elasticSearchTimeFormatToISO8601(timestampNode.findValue("from").asText());
                String to = Tools.elasticSearchTimeFormatToISO8601(timestampNode.findValue("to").asText());
                boundaries = new AbsoluteRange(from, to);
            } catch (Exception ignored) {}
View Full Code Here

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

      } catch (CharacterCodingException e1) {
        throw new RuntimeException("Could not decode the string", e1);
      }
      ObjectMapper mapper = new ObjectMapper();
      try {
        assertTrue(mapper.readTree(expected).equals(mapper.readTree(actualJson)));
      } catch (IOException e) {
        fail("Exception while serializing. Expected " + expected);
      }
    }
View Full Code Here

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

      } catch (CharacterCodingException e1) {
        throw new RuntimeException("Could not decode the string", e1);
      }
      ObjectMapper mapper = new ObjectMapper();
      try {
        assertTrue(mapper.readTree(expected).equals(mapper.readTree(actualJson)));
      } catch (IOException e) {
        fail("Exception while serializing. Expected " + expected);
      }
    }
View Full Code Here

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

            final InputStream configStream = configSource.getInputStream();
            buffer = toByteArray(configStream);
            configStream.close();
            final InputStream is = new ByteArrayInputStream(buffer);
            final ObjectMapper mapper = new ObjectMapper().configure(JsonParser.Feature.ALLOW_COMMENTS, true);
            root = mapper.readTree(is);
            if (root.size() == 1) {
                final Iterator<JsonNode> i = root.elements();
                root = i.next();
            }
            processAttributes(rootNode, root);
View Full Code Here

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

            for (String name : PathUtils.elements(path)) {
                tree = tree.addChild(name);
            }

            ObjectMapper mapper = new ObjectMapper();
            JsonNode node = mapper.readTree(request.getInputStream());
            if (node.isObject()) {
                post(node, tree);
                root.commit();
                doGet(request, response);
            } else {
View Full Code Here

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

  public Object readInput(InputStream input) {
    ObjectMapper mapper = format.getConfiguredObjectMapper();
   
    try {
      return mapper.readTree(input);
    } catch (JsonProcessingException e) {
      throw JSON_LOGGER.unableToParseInput(e);
    } catch (IOException e) {
      throw JSON_LOGGER.unableToParseInput(e);
    }
View Full Code Here

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

    public SimulationPlan create(File jsonFile) throws Exception {
        JsonFactory jsonFactory = new JsonFactory();
        jsonFactory.enable(Feature.ALLOW_COMMENTS);
        ObjectMapper mapper = new ObjectMapper(jsonFactory);
        JsonNode root = mapper.readTree(jsonFile);
        SimulationPlan simulation = new SimulationPlan();

        simulation.setIntervalType(SimulationPlan.IntervalType.fromText(getString(root.get("intervalType"), "minutes")));
        DateTimeService dateTimeService;
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.