Package org.json

Examples of org.json.JSONArray.opt()


    JSONArray allProjects;
    Vector<VOrionProjectStorage> projects = new Vector<VOrionProjectStorage>();
    try {
      allProjects = webWorkspace.getProjectsJSON();
      for(int i=0;i<allProjects.length();i++){
        JSONObject projObj = (JSONObject)allProjects.opt(i);
        String id = projObj.getString("Id");
        WebProject result = WebProject.fromId(id);
        String name = result.getName();
        try {
          projects.add(new VOrionProjectStorage(name, result.getProjectStore(), result, this));
View Full Code Here


            JSONArray jsonActual = (JSONArray)actual;
            if (jsonExpected.length() != jsonActual.length()) {
                return false;
            }
            for (int i = 0; i < jsonExpected.length(); ++i) {
                if (!isJSONEquals(jsonExpected.opt(i), jsonActual.opt(i))) {
                    return false;
                }
            }
            return true;
        }
View Full Code Here

    if (acceptsNoChild && children == null)
    {
      return null;
    }

    if (!acceptsNoChild && (children == null || children.length() == 0 || children.opt(0)==null))
    {
      throw new CruxGeneratorException("The widget ["+parentWidgetId+"], declared on View ["+getView().getId()+"], must contain at least one child.");
    }
    return children;
 
View Full Code Here

      return new DynamicConfigProperty(json.toString(), expressions, context);
    } else if (json instanceof JSONArray) {
      JSONArray jsonArray = (JSONArray) json;
      List<Object> values = new ArrayList<Object>(jsonArray.length());
      for (int i = 0, j = jsonArray.length(); i < j; ++i) {
        values.add(jsonToConfig(jsonArray.opt(i), expressions, context));
      }
      return Collections.unmodifiableList(values);
    } else if (json instanceof JSONObject) {
      return jsonToMap((JSONObject) json, expressions, context);
    }
View Full Code Here

            JSONArray jsonActual = (JSONArray)actual;
            if (jsonExpected.length() != jsonActual.length()) {
                return false;
            }
            for (int i = 0; i < jsonExpected.length(); ++i) {
                if (!isJSONEquals(jsonExpected.opt(i), jsonActual.opt(i))) {
                    return false;
                }
            }
            return true;
        }
View Full Code Here

    } else if( obj instanceof JSONArray ) {
      JSONArray jsonArr = (JSONArray)obj;
     
      // Iterate over children values
      for(int i=0,e=jsonArr.length(); i<e; ++i){
        Object value = jsonArr.opt(i);
        if( null != value ){
          findStructuresOfType(value, type, structures);
        }
      };
    }
View Full Code Here

            return new DynamicConfigProperty(json.toString(), expressions, context);
        } else if (json instanceof JSONArray) {
            JSONArray jsonArray = (JSONArray) json;
            List<Object> values = new ArrayList<Object>(jsonArray.length());
            for (int i = 0, j = jsonArray.length(); i < j; ++i) {
                values.add(jsonToConfig(jsonArray.opt(i), expressions, context));
            }
            return Collections.unmodifiableList(values);
        } else if (json instanceof JSONObject) {
            return jsonToMap((JSONObject) json, expressions, context);
        }
View Full Code Here

      return json.toString();
    } else if (json instanceof JSONArray) {
      JSONArray jsonArray = (JSONArray) json;
      ImmutableList.Builder<Object> values = ImmutableList.builder();
      for (int i = 0, j = jsonArray.length(); i < j; ++i) {
        values.add(jsonToConfig(jsonArray.opt(i)));
      }
      return values.build();
    } else if (json instanceof JSONObject) {
      return jsonToMap((JSONObject) json);
    }
View Full Code Here

    if (value instanceof JSONArray) {
      StringBuilder builder = new StringBuilder();
      builder.append("[");
      JSONArray a = (JSONArray) value;
      for (int i = 0; i < a.length(); i++) {
        Object element = a.opt(i);
        builder.append(convert(element));
        if (i < a.length() - 1) {
          builder.append(",");
        }
      }
View Full Code Here

    if (value instanceof JSONArray) {
      StringBuilder builder = new StringBuilder();
      builder.append("[");
      JSONArray a = (JSONArray) value;
      for (int i = 0; i < a.length(); i++) {
        Object element = a.opt(i);
        builder.append(convert(element));
        if (i < a.length() - 1) {
          builder.append(",");
        }
      }
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.