コード例 #1
0
ファイル: JSONObject.java プロジェクト: mbax/SuperBans
 /**
  * Construct a JSONObject from a subset of another JSONObject. An array of strings is used to
  * identify the keys that should be copied. Missing keys are ignored.
  *
  * @param jo A JSONObject.
  * @param names An array of strings.
  * @throws JSONException
  * @exception JSONException If a value is a non-finite number or if a name is duplicated.
  */
 public JSONObject(JSONObject jo, String[] names) {
   this();
   for (final String name : names) {
     try {
       this.putOnce(name, jo.opt(name));
     } catch (final Exception ignore) {
     }
   }
 }
コード例 #2
0
 /**
  * Construct a JSONObject from a subset of another JSONObject. An array of strings is used to
  * identify the keys that should be copied. Missing keys are ignored.
  *
  * @param jo A JSONObject.
  * @param names An array of strings.
  * @exception JSONException If a value is a non-finite number.
  */
 public JSONObject(JSONObject jo, String[] names) throws JSONException {
   this();
   for (int i = 0; i < names.length; i += 1) {
     putOpt(names[i], jo.opt(names[i]));
   }
 }
コード例 #3
0
 /**
  * Construct a JSONObject from a subset of another JSONObject. An array of strings is used to
  * identify the keys that should be copied. Missing keys are ignored.
  *
  * @param jo A JSONObject.
  * @param sa An array of strings.
  * @throws JSONException If a value is a non-finite number.
  */
 public JSONObject(JSONObject jo, String[] sa) throws JSONException {
   this();
   for (int i = 0; i < sa.length; i += 1) {
     putOpt(sa[i], jo.opt(sa[i]));
   }
 }