Examples of opt()


Examples of org.json.JSONObject.opt()

            if (temp == null) {
                throw new Exception(String.format("The node %s could not be found!", path));
            }
        }

        Object value = temp.opt(property);
        if (value == null) {
            throw new Exception(String.format("The node %s did not containt the property %s!", path, property));
        }
    }
View Full Code Here

Examples of org.json.JSONObject.opt()

    JSONObject clone = new JSONObject(base, JSONObject.getNames(base));
    // Walk parameter list for the merged object and merge recursively.
    String[] fields = JSONObject.getNames(merge);
    for (String field : fields) {
      Object existing = clone.opt(field);
      Object update = merge.get(field);
      if (JSONObject.NULL.equals(existing) || JSONObject.NULL.equals(update)) {
        // It's new custom config, not referenced in the prototype, or
        // it's removing a pre-configured value.
        clone.put(field, update);
View Full Code Here

Examples of org.json.JSONObject.opt()

    if (obj instanceof JSONObject) {
      JSONObject json = (JSONObject) obj;
     
      // Does this object have a "list" property that is an array?
      // TODO: add to specification
      Object childList = json.opt("list");
      if (childList != null && childList instanceof JSONArray) {
        return coerceToIterable(childList);
      }
     
      // A scalar JSON value is treated as a single element list.
View Full Code Here

Examples of org.json.JSONObject.opt()

      return new Result<List<TenpayAddress>>(error);
    }
    List<TenpayAddress> addresses = new ArrayList<TenpayAddress>();
    Integer total = Result.parseInteger(jsonObject.get("ret_num"));
    for (int i = 0; i < total; i++) {
      Integer index = Result.parseInteger(jsonObject.opt("Findex_" + i));
      if (index == null) {
        break;
      }
      TenpayAddress address = new TenpayAddress();
      address.setTotal(total);
View Full Code Here

Examples of org.json.JSONObject.opt()

        break;
      }
      TenpayAddress address = new TenpayAddress();
      address.setTotal(total);
      address.setIndex(index);
      address.setRegionId(Result.parseInteger(jsonObject.opt("FRegionId_" + i)));
      address.setStreet(jsonObject.optString("Faddrstreet_" + i));
      address.setZipcode(Result.toString(jsonObject.opt("Fzipcode_" + i)));
      address.setMobile(Result.toString(jsonObject.opt("Fmobile_" + i)));
      address.setTel(Result.toString(jsonObject.opt("Ftel_" + i)));
      address.setName(Result.toString(jsonObject.opt("Fname_" + i)));
View Full Code Here

Examples of org.json.JSONObject.opt()

      TenpayAddress address = new TenpayAddress();
      address.setTotal(total);
      address.setIndex(index);
      address.setRegionId(Result.parseInteger(jsonObject.opt("FRegionId_" + i)));
      address.setStreet(jsonObject.optString("Faddrstreet_" + i));
      address.setZipcode(Result.toString(jsonObject.opt("Fzipcode_" + i)));
      address.setMobile(Result.toString(jsonObject.opt("Fmobile_" + i)));
      address.setTel(Result.toString(jsonObject.opt("Ftel_" + i)));
      address.setName(Result.toString(jsonObject.opt("Fname_" + i)));
      address.setCreated(Result.parseDate(jsonObject.opt("Fcreate_time_" + i),
          "yyyy-MM-dd HH:mm:ss", Locale.CHINA));
View Full Code Here

Examples of org.json.JSONObject.opt()

      address.setTotal(total);
      address.setIndex(index);
      address.setRegionId(Result.parseInteger(jsonObject.opt("FRegionId_" + i)));
      address.setStreet(jsonObject.optString("Faddrstreet_" + i));
      address.setZipcode(Result.toString(jsonObject.opt("Fzipcode_" + i)));
      address.setMobile(Result.toString(jsonObject.opt("Fmobile_" + i)));
      address.setTel(Result.toString(jsonObject.opt("Ftel_" + i)));
      address.setName(Result.toString(jsonObject.opt("Fname_" + i)));
      address.setCreated(Result.parseDate(jsonObject.opt("Fcreate_time_" + i),
          "yyyy-MM-dd HH:mm:ss", Locale.CHINA));
      address.setModified(Result.parseDate(jsonObject.opt("Fmod_time_" + i), "yyyy-MM-dd HH:mm:ss",
View Full Code Here

Examples of org.json.JSONObject.opt()

      address.setIndex(index);
      address.setRegionId(Result.parseInteger(jsonObject.opt("FRegionId_" + i)));
      address.setStreet(jsonObject.optString("Faddrstreet_" + i));
      address.setZipcode(Result.toString(jsonObject.opt("Fzipcode_" + i)));
      address.setMobile(Result.toString(jsonObject.opt("Fmobile_" + i)));
      address.setTel(Result.toString(jsonObject.opt("Ftel_" + i)));
      address.setName(Result.toString(jsonObject.opt("Fname_" + i)));
      address.setCreated(Result.parseDate(jsonObject.opt("Fcreate_time_" + i),
          "yyyy-MM-dd HH:mm:ss", Locale.CHINA));
      address.setModified(Result.parseDate(jsonObject.opt("Fmod_time_" + i), "yyyy-MM-dd HH:mm:ss",
          Locale.CHINA));
View Full Code Here

Examples of org.json.JSONObject.opt()

      address.setRegionId(Result.parseInteger(jsonObject.opt("FRegionId_" + i)));
      address.setStreet(jsonObject.optString("Faddrstreet_" + i));
      address.setZipcode(Result.toString(jsonObject.opt("Fzipcode_" + i)));
      address.setMobile(Result.toString(jsonObject.opt("Fmobile_" + i)));
      address.setTel(Result.toString(jsonObject.opt("Ftel_" + i)));
      address.setName(Result.toString(jsonObject.opt("Fname_" + i)));
      address.setCreated(Result.parseDate(jsonObject.opt("Fcreate_time_" + i),
          "yyyy-MM-dd HH:mm:ss", Locale.CHINA));
      address.setModified(Result.parseDate(jsonObject.opt("Fmod_time_" + i), "yyyy-MM-dd HH:mm:ss",
          Locale.CHINA));
      address.setLastUsed(Result.parseDate(jsonObject.opt("Flastuse_time_" + i),
View Full Code Here

Examples of org.json.JSONObject.opt()

      address.setStreet(jsonObject.optString("Faddrstreet_" + i));
      address.setZipcode(Result.toString(jsonObject.opt("Fzipcode_" + i)));
      address.setMobile(Result.toString(jsonObject.opt("Fmobile_" + i)));
      address.setTel(Result.toString(jsonObject.opt("Ftel_" + i)));
      address.setName(Result.toString(jsonObject.opt("Fname_" + i)));
      address.setCreated(Result.parseDate(jsonObject.opt("Fcreate_time_" + i),
          "yyyy-MM-dd HH:mm:ss", Locale.CHINA));
      address.setModified(Result.parseDate(jsonObject.opt("Fmod_time_" + i), "yyyy-MM-dd HH:mm:ss",
          Locale.CHINA));
      address.setLastUsed(Result.parseDate(jsonObject.opt("Flastuse_time_" + i),
          "yyyy-MM-dd HH:mm:ss", Locale.CHINA));
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.