예제 #1
0
 public JsonArray add(Object obj) {
   checkCopy();
   if (obj instanceof JsonObject) {
     obj = ((JsonObject) obj).map;
   } else if (obj instanceof JsonArray) {
     obj = ((JsonArray) obj).list;
   }
   list.add(obj);
   return this;
 }
예제 #2
0
 @SuppressWarnings("unchecked")
 static List<Object> convertList(List<?> list) {
   List<Object> arr = new ArrayList<>(list.size());
   for (Object obj : list) {
     if (obj instanceof Map) {
       arr.add(JsonObject.convertMap((Map<String, Object>) obj));
     } else if (obj instanceof JsonObject) {
       arr.add(((JsonObject) obj).toMap());
     } else if (obj instanceof List) {
       arr.add(convertList((List<?>) obj));
     } else {
       arr.add(obj);
     }
   }
   return arr;
 }
예제 #3
0
 public JsonArray addBinary(byte[] value) {
   checkCopy();
   String encoded = org.vertx.java.core.json.impl.Base64.encodeBytes(value);
   list.add(encoded);
   return this;
 }
예제 #4
0
 public JsonArray addBoolean(Boolean value) {
   checkCopy();
   list.add(value);
   return this;
 }
예제 #5
0
 public JsonArray addNumber(Number value) {
   checkCopy();
   list.add(value);
   return this;
 }
예제 #6
0
 public JsonArray addArray(JsonArray value) {
   checkCopy();
   list.add(value.list);
   return this;
 }
예제 #7
0
 public JsonArray addObject(JsonObject value) {
   checkCopy();
   list.add(value.map);
   return this;
 }
예제 #8
0
 public JsonArray addString(String str) {
   checkCopy();
   list.add(str);
   return this;
 }
예제 #9
0
 public boolean contains(Object value) {
   return list.contains(value);
 }
예제 #10
0
 public <T> T get(final int index) {
   return convertObject(list.get(index));
 }
예제 #11
0
 public int size() {
   return list.size();
 }