Package org.codehaus.jackson

Examples of org.codehaus.jackson.JsonNode.path()


        JsonNode jsonNode = this.jsonNode;
        final String[] keys = path.split("\\.");
        for (final String key : keys) {
            final PathNode pathNode = PathNode.parse(key);
            if (!pathNode.getKey().isEmpty()) {
                jsonNode = jsonNode.path(pathNode.getKey());
            } else {
                // pathNode is criteria only; don't change jsonNode
            }
            if (jsonNode.isNull()) {
                return jsonNode;
View Full Code Here


    JsonNode root = mapper.readValue(queries, JsonNode.class);
    Iterator<String> keysIter = root.getFieldNames();
    while(keysIter.hasNext()){
      String key = keysIter.next();
      //FIXME parsed twice
      ReconciliationRequest request = ReconciliationRequest.valueOf(root.path(key).toString());
      multiRequest.put(key, request);
    }
   
    return ImmutableMap.copyOf(multiRequest);
  }
View Full Code Here

 
  public static ReconciliationRequest valueOf(String json) throws JsonParseException, JsonMappingException, IOException{
    ObjectMapper mapper = new ObjectMapper();
    JsonNode node = mapper.readValue(json, JsonNode.class);
    //get query
    String query = node.path("query").getTextValue();
    //get types. can be a single string or an array of strings
    String[] types;
   
    JsonNode typesNode = node.path("type");
    if(! typesNode.isMissingNode()){
View Full Code Here

        for (final String key : keys) {
            final PathNode pathNode = PathNode.parse(key);
            if (!pathNode.getKey().isEmpty()) {
                // grab format (if present) before moving down the path
                format = getFormatValueIfAnyFrom(jsonNode);
                jsonNode = jsonNode.path(pathNode.getKey());
            } else {
                // pathNode is criteria only; don't change jsonNode
            }
            if (jsonNode.isNull()) {
                return new NodeAndFormat(jsonNode, format);
View Full Code Here

            if (token.startsWith("["))
            {
                if (o.isArray())
                {
                    int index = Integer.valueOf(token.substring(1, token.length() - 1));
                    o = o.path(index);
                }
                else
                {
                    throw new IllegalArgumentException("Current node is not an array, but expression is expecting one");
                }
View Full Code Here

                    throw new IllegalArgumentException("Current node is not an array, but expression is expecting one");
                }
            }
            else
            {
                o = o.path(token);
            }

            if (o.isMissingNode())
            {
                throw new IllegalArgumentException("Not a valid element: " + token);
View Full Code Here

    try {
      String taskParams = entity.getText();
      JsonNode taskJSON = new ObjectMapper().readTree(taskParams);
     
      String description = null;
      if(taskJSON.path("description") != null && taskJSON.path("description").getTextValue() != null) {
        description = taskJSON.path("description").getTextValue();
        task.setDescription(description);
      }
     
      String assignee = null;
View Full Code Here

    try {
      String taskParams = entity.getText();
      JsonNode taskJSON = new ObjectMapper().readTree(taskParams);
     
      String description = null;
      if(taskJSON.path("description") != null && taskJSON.path("description").getTextValue() != null) {
        description = taskJSON.path("description").getTextValue();
        task.setDescription(description);
      }
     
      String assignee = null;
View Full Code Here

      String taskParams = entity.getText();
      JsonNode taskJSON = new ObjectMapper().readTree(taskParams);
     
      String description = null;
      if(taskJSON.path("description") != null && taskJSON.path("description").getTextValue() != null) {
        description = taskJSON.path("description").getTextValue();
        task.setDescription(description);
      }
     
      String assignee = null;
      if(taskJSON.path("assignee") != null && taskJSON.path("assignee").getTextValue() != null) {
View Full Code Here

        description = taskJSON.path("description").getTextValue();
        task.setDescription(description);
      }
     
      String assignee = null;
      if(taskJSON.path("assignee") != null && taskJSON.path("assignee").getTextValue() != null) {
        assignee = taskJSON.path("assignee").getTextValue();
        task.setAssignee(assignee);
      }
     
      String owner = null;
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.