private static final class JsonArrayBuilderImpl.JsonArrayImpl extends java.util.AbstractList<JsonValue> implements JsonArray
JsonValue.ValueType| Modifier and Type | Field and Description |
|---|---|
private BufferPool |
bufferPool |
private java.util.List<JsonValue> |
valueList |
| Constructor and Description |
|---|
JsonArrayImpl(java.util.List<JsonValue> valueList,
BufferPool bufferPool) |
| Modifier and Type | Method and Description |
|---|---|
JsonValue |
get(int index) |
boolean |
getBoolean(int index)
Returns the boolean value at the specified position.
|
boolean |
getBoolean(int index,
boolean defaultValue)
Returns the boolean value at the specified position.
|
int |
getInt(int index)
A convenience method for
getJsonNumber(index).intValue(). |
int |
getInt(int index,
int defaultValue)
Returns the int value of the
JsonNumber at the specified position. |
JsonArray |
getJsonArray(int index)
Returns the array value at the specified position in this array.
|
JsonNumber |
getJsonNumber(int index)
Returns the number value at the specified position in this array.
|
JsonObject |
getJsonObject(int index)
Returns the object value at the specified position in this array.
|
JsonString |
getJsonString(int index)
Returns the string value at ths specified position in this array.
|
java.lang.String |
getString(int index)
A convenience method for
getJsonString(index).getString(). |
java.lang.String |
getString(int index,
java.lang.String defaultValue)
Returns the
String value of JsonString at the specified
position in this JSON array values. |
<T extends JsonValue> |
getValuesAs(java.lang.Class<T> clazz)
Returns a list a view of the specified type for the array.
|
JsonValue.ValueType |
getValueType()
Returns the value type of this JSON value.
|
boolean |
isNull(int index)
Returns
true if the value at the specified location in this
array is JsonValue.NULL. |
int |
size() |
java.lang.String |
toString()
Returns JSON text for this JSON value.
|
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subListaddAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArrayclone, finalize, getClass, notify, notifyAll, wait, wait, waitprivate final java.util.List<JsonValue> valueList
private final BufferPool bufferPool
JsonArrayImpl(java.util.List<JsonValue> valueList, BufferPool bufferPool)
public int size()
public JsonObject getJsonObject(int index)
JsonArray(JsonObject)get(index).getJsonObject in interface JsonArrayindex - index of the value to be returnedpublic JsonArray getJsonArray(int index)
JsonArray(JsonArray)get(index).getJsonArray in interface JsonArrayindex - index of the value to be returnedpublic JsonNumber getJsonNumber(int index)
JsonArray(JsonNumber)get(index).getJsonNumber in interface JsonArrayindex - index of the value to be returnedpublic JsonString getJsonString(int index)
JsonArray(JsonString)get(index).getJsonString in interface JsonArrayindex - index of the value to be returnedpublic <T extends JsonValue> java.util.List<T> getValuesAs(java.lang.Class<T> clazz)
JsonArrayClassCastException, if there is a value of wrong type in this
array. Unfortunately, the exception can occur at any time after this
method returns.getValuesAs in interface JsonArrayclazz - a JsonValue typepublic java.lang.String getString(int index)
JsonArraygetJsonString(index).getString().public java.lang.String getString(int index,
java.lang.String defaultValue)
JsonArrayString value of JsonString at the specified
position in this JSON array values. If JsonString is found,
its JsonString.getString() is returned. Otherwise,
the specified default value is returned.public int getInt(int index)
JsonArraygetJsonNumber(index).intValue().public int getInt(int index,
int defaultValue)
JsonArrayJsonNumber at the specified position.
If the value at that position is a JsonNumber,
this method returns JsonNumber.intValue(). Otherwise
this method returns the specified default value.public boolean getBoolean(int index)
JsonArrayJsonValue.TRUE
this method returns true. If the value at the specified position
is JsonValue.FALSE this method returns false.getBoolean in interface JsonArrayindex - index of the JSON boolean valuepublic boolean getBoolean(int index,
boolean defaultValue)
JsonArrayJsonValue.TRUE
this method returns true. If the value at the specified position
is JsonValue.FALSE this method returns false.
Otherwise this method returns the specified default value.getBoolean in interface JsonArrayindex - index of the JSON boolean valuepublic boolean isNull(int index)
JsonArraytrue if the value at the specified location in this
array is JsonValue.NULL.public JsonValue.ValueType getValueType()
JsonValuegetValueType in interface JsonValuepublic JsonValue get(int index)