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.
Methods inherited from class com.sdicons.json.model.JSONValue |
decorate, getCol, getData, getLine, getStreamName, isArray, isBoolean, isComplex, isDecimal, isInteger, isNull, isNumber, isObject, isSimple, isString, render, setData, setLineCol, setStreamName |
JSONArray
public JSONArray()
size
public int size()
- Specified by:
size
in class JSONComplex
- Returns:
- The length of the array (list).
getValue
public List<JSONValue> getValue()
- Returns:
- The JSON elements in the array (list).
toString
public String toString()
- Overrides:
toString
in class 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:
IndexOutOfBoundsException
- When there is no element at the specified position.
render
protected String render(boolean aPretty,
String aIndent)
- Description copied from class:
JSONValue
- Convert the JSON value into a string representation (JSON representation).
- Specified by:
render
in class JSONValue
- Parameters:
aPretty
- Indicating if the print should be made pretty (human readers) or compact (transmission or storage).aIndent
- Starting indent.
- Returns:
- A JSON representation.
equals
public boolean equals(Object o)
- Overrides:
equals
in class Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
strip
public Object strip()
- Remove all JSON information. In the case of a JSONString, a Java String is returned.
The elements of the array are stripped as well.
- Specified by:
strip
in class JSONValue
- Returns:
- A Java String representing the contents of the JSONString.
Copyright © 2011. All Rights Reserved.