Package com.sdicons.json.model
Class JSONArray
- java.lang.Object
-
- com.sdicons.json.model.JSONValue
-
- com.sdicons.json.model.JSONComplex
-
- com.sdicons.json.model.JSONArray
-
public class JSONArray extends JSONComplex
Represents a JSON array (list), an ordered list of values ... Example:[ "one", "two", "tree" ]
is an array of 3 strings.
-
-
Constructor Summary
Constructors Constructor Description JSONArray()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
JSONValue
get(int i)
Utility method, get an element at a specific position in the list.java.util.List<JSONValue>
getValue()
int
hashCode()
protected java.lang.String
render(boolean aPretty, java.lang.String aIndent)
Convert the JSON value into a string representation (JSON representation).int
size()
java.lang.Object
strip()
Remove all JSON information.java.lang.String
toString()
-
-
-
Field Detail
-
array
private java.util.List<JSONValue> array
-
-
Method Detail
-
size
public int size()
- Specified by:
size
in classJSONComplex
- Returns:
- The length of the array (list).
-
getValue
public java.util.List<JSONValue> getValue()
- Returns:
- The JSON elements in the array (list).
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
get
public JSONValue get(int i)
Utility method, get an element at a specific position in the list. You do not have to get the list value first with getValue() first.- Parameters:
i
- Index of the element to return.- Returns:
- Returns the element at the specified position in this list.
- Throws:
java.lang.IndexOutOfBoundsException
- When there is no element at the specified position.
-
render
protected java.lang.String render(boolean aPretty, java.lang.String aIndent)
Description copied from class:JSONValue
Convert the JSON value into a string representation (JSON representation).
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-