Package top.focess.util.json
Class JSONList
- java.lang.Object
-
- top.focess.util.json.JSONObject
-
- top.focess.util.json.JSONList
-
- All Implemented Interfaces:
Iterable<JSONObject>,IJSONList
public class JSONList extends JSONObject implements Iterable<JSONObject>, IJSONList
This class is used to define a JSON object as List.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Tget(int index)Get the value at the given indexJSONgetJSON(int index)Get as JSON at the given indexJSONListgetJSONList()JSONListgetList(int index)Get the list at the given indexList<?>getValues()booleanisEmpty()Iterator<JSONObject>iterator()intsize()Get the size of this JSON instance Note: this is for JSONList only.JSONDoubleListtoDoubles()JSONIntListtoInts()StringtoJson()Translate this JSON instance into json StringStringtoString()-
Methods inherited from class top.focess.util.json.JSONObject
contains, get, getJSON, getList, parse, parse
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
get
public <T> T get(int index)
Description copied from class:JSONObjectGet the value at the given indexNote: this is for JSONList only.
- Overrides:
getin classJSONObject- Type Parameters:
T- the type of the value- Parameters:
index- the index of the value- Returns:
- the value at the given index
-
getJSON
public JSON getJSON(int index)
Description copied from class:JSONObjectGet as JSON at the given indexNote: this is for JSONList only.
- Overrides:
getJSONin classJSONObject- Parameters:
index- the index of the JSON- Returns:
- the JSON at the given index
-
getList
public JSONList getList(int index)
Description copied from class:JSONObjectGet the list at the given indexNote: this is for JSONList only.
- Overrides:
getListin classJSONObject- Parameters:
index- the index of the list- Returns:
- the list at the given index
-
getValues
public List<?> getValues()
-
toJson
public String toJson()
Description copied from class:JSONObjectTranslate this JSON instance into json String- Specified by:
toJsonin classJSONObject- Returns:
- json String translated from this JSON instance
-
size
public int size()
Description copied from class:JSONObjectGet the size of this JSON instance Note: this is for JSONList only.- Specified by:
sizein interfaceIJSONList- Overrides:
sizein classJSONObject- Returns:
- the size of this JSON instance
-
isEmpty
public boolean isEmpty()
-
iterator
@NotNull public Iterator<JSONObject> iterator() throws JSONParseException
- Specified by:
iteratorin interfaceIterable<JSONObject>- Throws:
JSONParseException
-
toInts
@NotNull public JSONIntList toInts()
-
toDoubles
@NotNull public JSONDoubleList toDoubles()
-
getJSONList
public JSONList getJSONList()
- Specified by:
getJSONListin interfaceIJSONList
-
-