MCPcopy Index your code
hub / github.com/Tencent/APIJSON / JSONList

Interface JSONList

APIJSONORM/src/main/java/apijson/JSONList.java:14–312  ·  view source on GitHub ↗

Custom JSONList implementation based on ArrayList to replace com.alibaba.fastjson.JSONList Maintains same API as fastjson but uses standard Java List implementation @author Lemon

Source from the content-addressed store, hash-verified

12 * @author Lemon
13 */
14public interface JSONList<M extends Map<String, Object>, L extends List<Object>> extends List<Object> {
15 public static final String TAG = "JSONList";
16
17 ///**
18 // * Create an empty JSONList
19 // */
20 //default JSONList() {
21 // super();
22 //}
23 //
24 //private int initialCapacity = 10;
25 ///**
26 // * Create a JSONList with initial capacity
27 // * @param initialCapacity the initial capacity
28 // */
29 //default JSONList(int initialCapacity) {
30 // super(initialCapacity);
31 //}
32 //
33 ///**
34 // * Create a JSONList from a Collection
35 // * @param collection the collection to copy from
36 // */
37 //default JSONList(Collection<?> collection) {
38 // super(collection);
39 //}
40 //
41 ///**
42 // * Create a JSONList from a JSON string
43 // * @param json JSON string
44 // */
45 //default JSONList(String json) {
46 // this();
47 // List<Object> list = JSON.parseArray(json);
48 // if (list != null) {
49 // addAll(list);
50 // }
51 //}
52 //
53 /**
54 * Get a JSONMap at the specified index
55 * @param index the index
56 * @return the JSONMap or null if not a JSONMap
57 */
58 default M getJSONObject(int index) {
59 if (index < 0 || index >= size()) {
60 return null;
61 }
62
63 Object obj = get(index);
64 if (obj instanceof Map<?, ?>) {
65 return JSON.createJSONObject((Map<? extends String, ?>) obj);
66 }
67
68 return null;
69 }
70
71 /**

Callers

nothing calls this directly

Implementers 1

JSONAPIJSONORM/src/main/java/apijson/JSON.

Calls

no outgoing calls

Tested by

no test coverage detected