Package org.json

Examples of org.json.JSONObject.opt()


      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));
      address.setUsedCount(Result.parseInteger(jsonObject.opt("FUsedCount_" + i)));
    }
View Full Code Here


      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));
      address.setUsedCount(Result.parseInteger(jsonObject.opt("FUsedCount_" + i)));
    }
    return new Result<List<TenpayAddress>>(addresses);
  }
View Full Code Here

          "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));
      address.setUsedCount(Result.parseInteger(jsonObject.opt("FUsedCount_" + i)));
    }
    return new Result<List<TenpayAddress>>(addresses);
  }

  public OAuth2 getOAuth2() {
View Full Code Here

                Map<String, String> facetProps = new HashMap<String, String>();
                facetProps.put("type", type);
                facetProps.put("column", fieldName);
                JSONObject column = columnMap.get(fieldName);
                String columnType = (column == null) ? "" : column.optString("type", "");
                if (column != null && column.opt("activity") != null && column.optBoolean("activity")) {
                    columnType = "aint";
                }
                facetProps.put("column_type", columnType);
                facetProps.put("depends", dependSet.toString());
View Full Code Here

      sb.append(line);
    String res = sb.toString();
    // System.out.println("res: " + res);
    res = res.replace('\u0000', '*')// replace the seperator for test case;
    JSONObject ret = new JSONObject(res);
    if (ret.opt("totaldocs") !=null){
     // assertEquals(15000L, ret.getLong("totaldocs"));
    }
    return ret;
  }

View Full Code Here

                  JSONArray jsonValues = jsonParamValues.optJSONArray(RequestConverter2.FACETINIT_VALUES);
                  if (jsonValues == null)
                  {
                    // Accept scalar values here too.  This is useful in
                    // supporting variable substitutions.
                    Object value = jsonParamValues.opt(RequestConverter2.FACETINIT_VALUES);
                    if (value != null)
                    {
                      jsonValues = new FastJSONArray().put(value);
                    }
                  }
View Full Code Here

      return ret;
    }
    Iterator<String> iter = params.keys();
    if(iter.hasNext()){
      String key = iter.next();
      Object val = params.opt(key);
      if (val != null) {
        ret.put(key, val.toString());
      }
    }
    return ret;
View Full Code Here

      return ret;
    }
    Iterator keys = templatesJson.keys();
    while (keys.hasNext()) {
      String templateName = (String) keys.next();
      Object templateValueObj = templatesJson.opt(templateName);
      if (templateValueObj != null &&
          (templateValueObj instanceof String ||
           templateValueObj instanceof Number ||
           templateValueObj instanceof JSONArray ||
           templateValueObj instanceof JSONObject)) {
View Full Code Here

  @Override
  protected SenseiFilter doConstructFilter(Object param) throws Exception
  {
    JSONObject json = (JSONObject)param;
    Object obj = json.opt(MUST_PARAM);
    List<SenseiFilter> andFilters = new ArrayList<SenseiFilter>();
    if (obj != null)
    {
      if (obj instanceof JSONArray)
      {
View Full Code Here

      else if (obj instanceof JSONObject)
      {
        andFilters.add(FilterConstructor.constructFilter((JSONObject)obj, _qparser));
      }
    }
    obj = json.opt(MUST_NOT_PARAM);
    if (obj != null)
    {
      if (obj instanceof JSONArray)
      {
        for (int i=0; i<((JSONArray)obj).length(); ++i)
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.