Package com.threealike.life.thirdparty.org.json

Examples of com.threealike.life.thirdparty.org.json.JSONArray


      Env.SHUT_LISTENERS.put(label, new ArrayList<ServiceStopListener>());
    Env.SHUT_LISTENERS.get(label).add(listener);
  }
 
  public static final JSONObject getServiceConfig(String serviceLabel) {
    JSONArray services = getConfig().getJSONArray("services");
    for(int i=0; i < services.length(); i++) {
      JSONObject service = services.getJSONObject(i);
      if(service.getString("label").equals(serviceLabel)) {
        return service;
      }
    }
    return null;
View Full Code Here


//    if(configResource == null) return null;
//    JSONArray allActual = new JSONArray(configResource);
//    if(allActual == null)
//      allActual = new JSONArray();
    JSONArray allActual = null;
    if(configResource == null)
      allActual = new JSONArray("[{'apply':['"+MODE+"']}]");
    else
      allActual = new JSONArray(configResource, true);
   
    tmp = new JSONObject();
   
    for(int i=0; i < allActual.length(); i++) {
      JSONObject next = allActual.getJSONObject(i);
      if(!next.has("apply")) {
        throw new RuntimeException("required key, \"apply\" not found in config block");
      }
      JSONArray apply = next.getJSONArray("apply");
      inner:
      for(int j=0; j < apply.length(); j++) {
        if(apply.getString(j).equals(MODE)) {
//          if(CONF.get(appLabel) == null)
//            CONF.put(appLabel, next);
//          else {
            for(Iterator it = next.keys(); it.hasNext();) {
              String next1 = (String)it.next();
View Full Code Here

            break;
          }
        }
      }
      if(apply == null)
        apply = new JSONArray();
    } else if(type == Types.Object) {
      if(parent == null) {
        if(tmp.has(key[index]))
          apply = tmp.getJSONObject(key[index]);
      } else if(parent instanceof JSONObject) {
View Full Code Here

          validate(possible, nextNode, level+1);
      }
    }
    if(node instanceof JSONArray) {
      STACK[level] = "[]";
      JSONArray _node = (JSONArray)node;
      for(int i=0; i < _node.length(); i++) {
        nextNodeType = checkType(possible, (nextNode=_node.get(i)), level);
        if(nextNodeType == Types.Object || nextNodeType == Types.Array)
          validate(possible, nextNode, level+1);
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.threealike.life.thirdparty.org.json.JSONArray

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.