コード例 #1
0
ファイル: JsonArray.java プロジェクト: chandrasekhar4u/restfb
 /**
  * Put or replace an object value in the JsonArray. If the index is greater than the length of the
  * JsonArray, then null elements will be added as necessary to pad it out.
  *
  * @param index The subscript.
  * @param value The value to put into the array. The value should be a Boolean, Double, Integer,
  *     JsonArray, JsonObject, Long, or String, or the JsonObject.NULL object.
  * @return this.
  * @throws JsonException If the index is negative or if the the value is an invalid number.
  */
 public JsonArray put(int index, Object value) {
   JsonObject.testValidity(value);
   if (index < 0) {
     throw new JsonException("JsonArray[" + index + "] not found.");
   }
   if (index < length()) {
     this.myArrayList.set(index, value);
   } else {
     while (index != length()) {
       put(JsonObject.NULL);
     }
     put(value);
   }
   return this;
 }
コード例 #2
0
ファイル: JsonArray.java プロジェクト: chandrasekhar4u/restfb
 /**
  * Append a double value. This increases the array's length by one.
  *
  * @param value A double value.
  * @throws JsonException if the value is not finite.
  * @return this.
  */
 public JsonArray put(double value) {
   Double d = new Double(value);
   JsonObject.testValidity(d);
   put(d);
   return this;
 }