Package org.json

Examples of org.json.JSONObject.optInt()


     
      // Get current version of document
      int diskVersion = 0;
      {
        JSONObject jsonDoc = doc.getJSONObject();
        diskVersion = jsonDoc.optInt(PROP_NAME_VERSION, 0);
      }

      // Get document from the database, if it exists, and figure out if
      // the disk version is newer than that found in the database
      boolean updateRequired = true;
View Full Code Here


      {
        boolean exists = couchDb.documentExists(DD_ID);
        if( exists ) {
          JSONObject uploaded = couchDb.getDocument(DD_ID);
          if( null != uploaded ){
            int uploadedVersion = uploaded.optInt(PROP_NAME_VERSION, 0);
            if( uploadedVersion > diskVersion ){
              updateRequired = false;
            }
          }
        }
View Full Code Here

     
      // Get current version of document
      int diskVersion = 0;
      {
        JSONObject jsonDoc = doc.getJSONObject();
        diskVersion = jsonDoc.optInt(PROP_NAME_VERSION, 0);
      }

      // Get document from the database, if it exists, and figure out if
      // the disk version is newer than that found in the database
      boolean updateRequired = true;
View Full Code Here

      {
        boolean exists = couchDb.documentExists(DD_ID);
        if( exists ) {
          JSONObject uploaded = couchDb.getDocument(DD_ID);
          if( null != uploaded ){
            uploadedVersion = uploaded.optInt(PROP_NAME_VERSION, 0);
            if( uploadedVersion > diskVersion ){
              updateRequired = false;
            }
          }
        }
View Full Code Here

    if ( ju == null ) {
      throw new JSONException("no user element found in json object");
    }
   
   
    Integer total_api_access_count = ju.optInt("total_api_access_count");
    if ( total_api_access_count != null ) {
      user.setTotalApiAccesCount(total_api_access_count);
    }
   
    JSONArray createable_roles = ju.optJSONArray("createable_roles");
View Full Code Here

    JSONArray createable_roles = ju.optJSONArray("createable_roles");
    if ( createable_roles != null ) {
      user.setCreateableRoles(CosmFactory.toStringArray(createable_roles));
    }
   
    Integer datastreams_count = ju.optInt("datastreams_count");
    if ( datastreams_count != null ) {
      user.setDatastreamsCount(datastreams_count);
    }
   
    String email_hash = ju.optString("email_hash");
View Full Code Here

    Boolean provisioning_enabled = ju.optBoolean("provisioning_enabled");
    if ( provisioning_enabled != null ) {
      user.setProvisioningEnabled(provisioning_enabled);
    }
   
    Integer feeds_count = ju.optInt("feeds_count");
    if ( feeds_count != null ) {
      user.setFeedsCount(feeds_count);
    }
   
    Integer datastreams_allowed = ju.optInt("datastreams_allowed");
View Full Code Here

    Integer feeds_count = ju.optInt("feeds_count");
    if ( feeds_count != null ) {
      user.setFeedsCount(feeds_count);
    }
   
    Integer datastreams_allowed = ju.optInt("datastreams_allowed");
    if ( datastreams_allowed != null ) {
      user.setDatastreamsAllowed(datastreams_allowed);
    }

    Integer daily_api_access_count = ju.optInt("daily_api_access_count");
View Full Code Here

    Integer datastreams_allowed = ju.optInt("datastreams_allowed");
    if ( datastreams_allowed != null ) {
      user.setDatastreamsAllowed(datastreams_allowed);
    }

    Integer daily_api_access_count = ju.optInt("daily_api_access_count");
    if ( daily_api_access_count != null ) {
      user.setDailyApiAccessCount(daily_api_access_count);
    }

    String user_state = ju.optString("state");
View Full Code Here

      JSONArray aData = new JSONArray(data);
      final int n = aData.length();
      if (n > 0) {
        for (int i = 0; i < n; i++) {
          JSONObject tmp = aData.getJSONObject(i);
          list.add(new NumberResponse(tmp.optString("id"), tmp.optString("number"), tmp.optInt("mcc"), tmp.optInt("mnc"), tmp.optString("info"), tmp.optString("status"), tmp.optInt("date"), tmp.optInt("ported"), tmp.optInt("ported_from"), tmp.optString("price")) {
          });
        }
      }
    }
  }
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.