Package com.google.gwt.thirdparty.json

Examples of com.google.gwt.thirdparty.json.JSONObject


    json.put(ENTITY_NAME, entity.getJsniSignature());
    return json;
  }

  public static JSONObject writeJson(PackageDescriptor pkg) throws JSONException {
    JSONObject json = new JSONObject();
    json.put(ENTITY_NAME, pkg.getName());
    // classes
    JSONArray classes = new JSONArray();
    for (ClassDescriptor classDescriptor : pkg.getClasses()) {
      JSONObject jsonClass = writeJsonFromEntity(classDescriptor);
      jsonClass.put(ENTITY_NAME, classDescriptor.getName());
      // fields
      JSONArray fields = new JSONArray();
      for (FieldDescriptor fieldDescriptor : classDescriptor.getFields()) {
        fields.put(writeJsonFromMember(fieldDescriptor));
      }
      jsonClass.put(FIELDS, fields);
      // methods
      JSONArray methods = new JSONArray();
      for (MethodDescriptor methodDescriptor : classDescriptor.getMethods()) {
        JSONObject jsonMethod = writeJsonFromMember(methodDescriptor);
        jsonMethod.put(METHOD_ID, methodDescriptor.getUniqueId());
        jsonMethod.put(METHOD_DEPENDENTS, new JSONArray(methodDescriptor.getDependentPointers()));
        methods.put(jsonMethod);
      }
      jsonClass.put(METHODS, methods);

      classes.put(jsonClass);
View Full Code Here


      for (int i = 0; i < clss.length(); i++) {
        descriptor.addClass(readJsonClass(clss.getJSONObject(i), longName));
      }
      JSONArray packages = jsonObject.getJSONArray(PACKAGES);
      for (int i = 0; i < packages.length(); i++) {
        JSONObject subPackage = packages.getJSONObject(i);
        String packageName = subPackage.getString(ENTITY_NAME);
        descriptor.addPackage(readJsonPackage(subPackage, packageName,
            longName + (longName.isEmpty() ? "" : ".") + packageName));
      }
      return descriptor;
    }
View Full Code Here

      for (int i = 0; i < jsNames.length(); i++) {
        entity.addObfuscatedName(jsNames.getString(i));
      }
      JSONArray frags = jsonObject.getJSONArray(EntityRecorder.FRAGMENTS);
      for (int i = 0; i < frags.length(); i++) {
        JSONObject frag = frags.getJSONObject(i);
        entity.addFragment(
            new Fragment(frag.getInt(EntityRecorder.FRAGMENT_ID),
                frag.getInt(EntityRecorder.FRAGMENT_SIZE)));
      }
    }
View Full Code Here

    }
    this.permutationId = permutationId;
  }

  private JSONObject getSizeMetrics(int fragment) throws JSONException {
    JSONObject obj = new JSONObject();
    obj.put(FRAGMENT_ID, fragment);
    obj.put(FRAGMENT_SIZE, this.fragmentSizes[fragment]);
    obj.put(FRAGMENT_STR_VAR, this.otherSizes[fragment]);
    return obj;
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.thirdparty.json.JSONObject

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.