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; }
@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; }
public JsonArray addBinary(byte[] value) { checkCopy(); String encoded = org.vertx.java.core.json.impl.Base64.encodeBytes(value); list.add(encoded); return this; }
public JsonArray addBoolean(Boolean value) { checkCopy(); list.add(value); return this; }
public JsonArray addNumber(Number value) { checkCopy(); list.add(value); return this; }
public JsonArray addArray(JsonArray value) { checkCopy(); list.add(value.list); return this; }
public JsonArray addObject(JsonObject value) { checkCopy(); list.add(value.map); return this; }
public JsonArray addString(String str) { checkCopy(); list.add(str); return this; }
public boolean contains(Object value) { return list.contains(value); }
public <T> T get(final int index) { return convertObject(list.get(index)); }
public int size() { return list.size(); }