public class JsonArray
extends java.lang.Object
implements java.lang.Iterable<java.lang.Object>
JsonObject
Constructor and Description |
---|
JsonArray()
Creates an empty instance.
|
JsonArray(java.util.List list)
Creates an instance from a List.
|
Modifier and Type | Method and Description |
---|---|
JsonArray |
add(java.lang.Boolean value)
Adds a boolean to the JSON array.
|
JsonArray |
add(byte[] value)
Adds a binary value to the JSON array.
|
JsonArray |
add(java.lang.CharSequence value)
Adds a
CharSequence to the JSON array. |
JsonArray |
add(java.lang.Double value)
Adds a double to the JSON array.
|
JsonArray |
add(java.lang.Enum value)
Adds an enum to the JSON array.
|
JsonArray |
add(java.lang.Float value)
Adds a float to the JSON array.
|
JsonArray |
add(java.lang.Integer value)
Adds an integer to the JSON array.
|
JsonArray |
add(JsonArray value)
Adds another JSON array to the JSON array.
|
JsonArray |
add(JsonObject value)
Adds a JSON object to the JSON array.
|
JsonArray |
add(java.lang.Long value)
Adds a long to the JSON array.
|
JsonArray |
add(java.lang.Object value)
Adds an object to the JSON array.
|
JsonArray |
add(java.lang.String value)
Adds a string to the JSON array.
|
JsonArray |
addAll(JsonArray array)
Appends all of the elements in the specified array to the end of this JSON array.
|
JsonArray |
addNull()
Adds a
null value to the JSON array. |
JsonArray |
clear()
Removes all entries from the JSON array.
|
boolean |
contains(java.lang.Object value)
Returns
true if given value exist. |
boolean |
equals(java.lang.Object o) |
byte[] |
getBinary(int pos)
Returns the byte[] at position
pos in the array. |
java.lang.Boolean |
getBoolean(int pos)
Returns the boolean at position
pos in the array. |
java.lang.Double |
getDouble(int pos)
Returns the double at position
pos in the array. |
java.lang.Float |
getFloat(int pos)
Returns the Float at position
pos in the array. |
java.lang.Integer |
getInteger(int pos)
Returns the integer at position
pos in the array. |
JsonArray |
getJsonArray(int pos)
Returns the JsonArray at position
pos in the array. |
JsonObject |
getJsonObject(int pos)
Returns the JsonObject at position
pos in the array. |
java.lang.Long |
getLong(int pos)
Returns the long at position
pos in the array. |
java.lang.String |
getString(int pos)
Returns the string at position
pos in the array. |
java.lang.Object |
getValue(int pos)
Returns the object value at position
pos in the array. |
int |
hashCode() |
boolean |
hasNull(int pos)
Returns
true if there is a null value at given index. |
boolean |
isEmpty()
Returns
true if JSON array is empty. |
java.util.Iterator<java.lang.Object> |
iterator()
Returns an iterator over the values in the JSON array.
|
java.util.List<java.lang.Object> |
list()
Returns the underlying list.
|
java.lang.Object |
remove(int pos)
Removes the value at the specified position in the JSON array.
|
boolean |
remove(java.lang.Object value)
Removes the specified value from the JSON array.
|
int |
size()
Returns the number of values in this JSON array.
|
java.util.stream.Stream<java.lang.Object> |
stream()
Returns a Stream over the entries in the JSON array
|
java.lang.String |
toString() |
public JsonArray()
public JsonArray(java.util.List list)
public java.lang.String getString(int pos)
pos
in the array.public java.lang.Integer getInteger(int pos)
pos
in the array.public java.lang.Long getLong(int pos)
pos
in the array.public java.lang.Double getDouble(int pos)
pos
in the array.public java.lang.Float getFloat(int pos)
pos
in the array.public java.lang.Boolean getBoolean(int pos)
pos
in the array.public JsonObject getJsonObject(int pos)
pos
in the array.public JsonArray getJsonArray(int pos)
pos
in the array.public byte[] getBinary(int pos)
pos
in the array.
JSON itself has no notion of a binary, so this method assumes there is a String value and it contains a Base64 encoded binary, which it decodes if found and returns.
public java.lang.Object getValue(int pos)
pos
in the array.public boolean hasNull(int pos)
true
if there is a null
value at given index.public JsonArray add(java.lang.Enum value)
JSON has no concept of encoding Enums, so the Enum will be converted to a String using the Enum.name
method and the value added as a String.
public JsonArray add(java.lang.CharSequence value)
CharSequence
to the JSON array.public JsonArray add(java.lang.String value)
public JsonArray add(java.lang.Integer value)
public JsonArray add(java.lang.Long value)
public JsonArray add(java.lang.Double value)
public JsonArray add(java.lang.Float value)
public JsonArray add(java.lang.Boolean value)
public JsonArray addNull()
null
value to the JSON array.public JsonArray add(JsonObject value)
public JsonArray add(byte[] value)
JSON has no notion of binary so the binary will be base64 encoded to a String, and the String added.
public JsonArray add(java.lang.Object value)
public JsonArray addAll(JsonArray array)
public boolean contains(java.lang.Object value)
true
if given value exist.public boolean remove(java.lang.Object value)
public java.lang.Object remove(int pos)
public int size()
public boolean isEmpty()
true
if JSON array is empty.public java.util.List<java.lang.Object> list()
public JsonArray clear()
public java.util.Iterator<java.lang.Object> iterator()
iterator
in interface java.lang.Iterable<java.lang.Object>
public java.util.stream.Stream<java.lang.Object> stream()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
Copyright © 2003-present Jodd Team