Package com.baasbox.service.query.PartsLexer

Examples of com.baasbox.service.query.PartsLexer.Part


 
 
  public JsonNode json(JsonNode bodyJson) {
    Collections.reverse(this.parts);
    ObjectNode on = Json.newObject();
    Part last = null;
    for(Part p: parts){
      if(last==null){
        on.put(p.getName(), bodyJson);
        last = p;
      }else{
View Full Code Here


  }
 
  public String treeFields() {
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < this.parts.size(); i++) {
      Part p = this.parts.get(i);
      if(i>0){
        sb.append(".");
      }
      sb.append(p.getName());
     
    }
    return sb.toString();
   
  }
View Full Code Here

   
  }
  public String fullTreeFields() {
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < this.parts.size(); i++) {
      Part p = this.parts.get(i);
      if(i>0){
        sb.append(".");
      }
      sb.append(p.getName());
      if(p instanceof ArrayField){
        ArrayField af  = (ArrayField)p;
        sb.append("[").append(af.arrayIndex).append("]");
      }
     
View Full Code Here

      }
    }
    if(root.isMissingNode()){
      throw new MissingNodeException(pp.treeFields());
    }
    Part last = pp.last();
   
    if(last instanceof PartsLexer.ArrayField){
      PartsLexer.ArrayField arr = (PartsLexer.ArrayField)last;
      int index = arr.arrayIndex;
      root = root.path(last.getName());
      ArrayNode arrNode = (ArrayNode)root;
      if(arrNode.size()<=index){
        arrNode.add(data);
      }else{
        arrNode.set(index, data);
      }
      return root;
     
    }else{
      try{
        ((ObjectNode)root).put(last.getName(),data);
      }catch(Exception e){
        throw new MissingNodeException(pp.treeFields());
      }
      return root.get(last.getName());
    }
   
  }
View Full Code Here

TOP

Related Classes of com.baasbox.service.query.PartsLexer.Part

Copyright © 2018 www.massapicom. 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.