java.io.Serializable
, java.lang.Iterable<JsonValueBase>
public final class JsonArray extends JsonValueBase implements java.io.Serializable, java.lang.Iterable<JsonValueBase>
Constructor | Description |
---|---|
JsonArray() |
Default constructor.
|
JsonArray(java.lang.String json) |
Overloaded constructor.
|
Modifier and Type | Method | Description |
---|---|---|
void |
add(JsonValue item) |
Adds JSONValue item to array.
|
void |
add(JsonValueBase item) |
Adds JSONValueBase item to array.
|
void |
clear() |
Clears all array items and brings count to 0.
|
boolean |
contains(JsonValue item) |
Checks if a JSONValue item exits in array.
|
boolean |
contains(JsonValueBase item) |
Checks if a JsonValueBase item exits in array.
|
void |
copyTo(JsonValueBase[] array,
int arrayIndex) |
Copies items from provided array starting from a particular array index.
|
boolean |
equals(java.lang.Object obj) |
Checks if an obj is equal to this instance of JSONArray
|
int |
getCount() |
Gets the number of items in the json array.
|
JsonValueBase |
getItem(int index) |
Gets the item at the specified index for the JSON Arary.
|
java.util.Iterator<JsonValueBase> |
getIterator() |
Returns the
Iterator that iterates through JSONArray items. |
java.lang.Object |
getValue() |
Gets the json array instance.
|
java.util.Iterator<JsonValueBase> |
iterator() |
Returns an iterator over elements of type
T . |
boolean |
remove(JsonValue item) |
Removes JSONValue item from array.
|
boolean |
remove(JsonValueBase item) |
Removes JsonValueBase item from array.
|
void |
setItem(int index,
JsonValueBase value) |
Sets the value at the specified index of the json array.
|
java.lang.String |
toString() |
Returns JSONArray in string representation.
|
getDataType, parse, toJson
public JsonArray()
public JsonArray(java.lang.String json)
json
- JSONArray object in string format.public JsonValueBase getItem(int index)
index
- Zero based index of the json array.public java.util.Iterator<JsonValueBase> iterator()
T
.iterator
in interface java.lang.Iterable<JsonValueBase>
public void setItem(int index, JsonValueBase value) throws OperationFailedException
index
- Zero based index of the json array.value
- The value that is to be set at the specified index.OperationFailedException
public int getCount()
public java.lang.Object getValue()
getValue
in class JsonValueBase
public void add(JsonValue item) throws OperationFailedException
item
- JSONValue to be added.OperationFailedException
public void add(JsonValueBase item) throws OperationFailedException
item
- JSONValueBase to be added.OperationFailedException
public void copyTo(JsonValueBase[] array, int arrayIndex)
array
- Array from which the items have to be copied.arrayIndex
- Starting index of the array from which to start copying.public boolean remove(JsonValue item) throws OperationFailedException
item
- item to be removed.OperationFailedException
public boolean remove(JsonValueBase item) throws OperationFailedException
item
- item to be removed.OperationFailedException
public boolean contains(JsonValue item) throws OperationFailedException
item
- Item to be found.OperationFailedException
public boolean contains(JsonValueBase item) throws OperationFailedException
item
- Item to be found.OperationFailedException
public void clear()
public java.util.Iterator<JsonValueBase> getIterator()
Iterator
that iterates through JSONArray items.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- The object that is compared with this object.public java.lang.String toString()
toString
in class java.lang.Object