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 booleanequals(java.lang.Object o)JSONValueget(int i)Utility method, get an element at a specific position in the list.java.util.List<JSONValue>getValue()inthashCode()protected java.lang.Stringrender(boolean aPretty, java.lang.String aIndent)Convert the JSON value into a string representation (JSON representation).intsize()java.lang.Objectstrip()Remove all JSON information.java.lang.StringtoString()
-
-
-
Field Detail
-
array
private java.util.List<JSONValue> array
-
-
Method Detail
-
size
public int size()
- Specified by:
sizein 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:
toStringin 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:JSONValueConvert the JSON value into a string representation (JSON representation).
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-