Package com.github.tnakamot.json.value
Class JSONValueArray
- java.lang.Object
-
- com.github.tnakamot.json.value.JSONValue
-
- com.github.tnakamot.json.value.JSONValueStructured
-
- com.github.tnakamot.json.value.JSONValueArray
-
- Direct Known Subclasses:
JSONValueArrayImmutable
,JSONValueArrayMutable
public abstract class JSONValueArray extends JSONValueStructured implements List<JSONValue>
Represents one JSON 'array' value.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
add(boolean value)
Add a JSON boolean value to this array.boolean
add(double value)
Add a JSON number value to this array.abstract void
add(int i, JSONValue jsonValue)
boolean
add(long value)
Add a JSON number value to this array.abstract boolean
add(JSONValue jsonValue)
boolean
add(String value)
Add a JSON string value to this array.abstract boolean
addAll(int i, @NotNull Collection<? extends JSONValue> collection)
abstract boolean
addAll(@NotNull Collection<? extends JSONValue> collection)
abstract void
clear()
abstract boolean
contains(Object o)
abstract boolean
containsAll(@NotNull Collection<?> collection)
boolean
equals(Object o)
abstract JSONValue
get(int i)
JSONValueArray
getArray(int index)
Returns an array value at the specified position in this array.boolean
getBoolean(int index)
Returns a boolean value at the specified position in this array.double
getDouble(int index)
Returns a number value at the specified position in this array.long
getLong(int index)
Returns a number value at the specified position in this array.JSONValueObject
getObject(int index)
Returns an object value at the specified position in this array.String
getString(int index)
Returns a string value at the specified position in this array.int
hashCode()
abstract int
indexOf(Object o)
abstract boolean
isEmpty()
abstract @NotNull Iterator<JSONValue>
iterator()
abstract int
lastIndexOf(Object o)
abstract @NotNull ListIterator<JSONValue>
listIterator()
abstract @NotNull ListIterator<JSONValue>
listIterator(int i)
abstract JSONValue
remove(int i)
abstract boolean
remove(Object o)
abstract boolean
removeAll(@NotNull Collection<?> collection)
abstract boolean
retainAll(@NotNull Collection<?> collection)
abstract JSONValue
set(int i, JSONValue jsonValue)
abstract int
size()
abstract @NotNull List<JSONValue>
subList(int i, int i1)
abstract Object[]
toArray()
abstract <T> T[]
toArray(T[] ts)
-
Methods inherited from class com.github.tnakamot.json.value.JSONValueStructured
begin, end
-
Methods inherited from class com.github.tnakamot.json.value.JSONValue
toTokenBytes, toTokenBytes, toTokenString, toTokenString, type
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
replaceAll, sort, spliterator
-
-
-
-
Method Detail
-
size
public abstract int size()
-
isEmpty
public abstract boolean isEmpty()
-
contains
public abstract boolean contains(Object o)
-
toArray
public abstract Object[] toArray()
-
add
public abstract boolean add(JSONValue jsonValue)
-
remove
public abstract boolean remove(Object o)
-
addAll
public abstract boolean addAll(@NotNull @NotNull Collection<? extends JSONValue> collection)
-
addAll
public abstract boolean addAll(int i, @NotNull @NotNull Collection<? extends JSONValue> collection)
-
clear
public abstract void clear()
-
add
public abstract void add(int i, JSONValue jsonValue)
-
lastIndexOf
public abstract int lastIndexOf(Object o)
- Specified by:
lastIndexOf
in interfaceList<JSONValue>
-
listIterator
@NotNull public abstract @NotNull ListIterator<JSONValue> listIterator()
- Specified by:
listIterator
in interfaceList<JSONValue>
-
listIterator
@NotNull public abstract @NotNull ListIterator<JSONValue> listIterator(int i)
- Specified by:
listIterator
in interfaceList<JSONValue>
-
retainAll
public abstract boolean retainAll(@NotNull @NotNull Collection<?> collection)
-
removeAll
public abstract boolean removeAll(@NotNull @NotNull Collection<?> collection)
-
containsAll
public abstract boolean containsAll(@NotNull @NotNull Collection<?> collection)
- Specified by:
containsAll
in interfaceCollection<JSONValue>
- Specified by:
containsAll
in interfaceList<JSONValue>
-
toArray
public abstract <T> T[] toArray(T[] ts)
-
add
public boolean add(boolean value)
Add a JSON boolean value to this array.- Parameters:
value
- boolean value to add- Returns:
- true (as specified by
Collection.add(Object)
-
add
public boolean add(long value)
Add a JSON number value to this array.- Parameters:
value
- a number value to add- Returns:
- true (as specified by
Collection.add(Object)
-
add
public boolean add(double value)
Add a JSON number value to this array.- Parameters:
value
- a number value to add- Returns:
- true (as specified by
Collection.add(Object)
-
add
public boolean add(String value)
Add a JSON string value to this array.- Parameters:
value
- a String value to add. Null is considered as an empty string.- Returns:
- true (as specified by
Collection.add(Object)
-
getBoolean
public boolean getBoolean(int index) throws IndexOutOfBoundsException, WrongValueTypeException
Returns a boolean value at the specified position in this array.- Parameters:
index
- index of the value to return- Returns:
- the boolean value at the specified position in this array
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= size())WrongValueTypeException
- if the value type at the specified index is not boolean
-
getLong
public long getLong(int index) throws IndexOutOfBoundsException, WrongValueTypeException, NumberFormatException
Returns a number value at the specified position in this array.- Parameters:
index
- index of the value to return- Returns:
- the long value at the specified position in this array
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= size())WrongValueTypeException
- if the value type at the specified index is not numberNumberFormatException
- if the value cannot be converted to a Java long value
-
getDouble
public double getDouble(int index) throws IndexOutOfBoundsException, WrongValueTypeException, NumberFormatException
Returns a number value at the specified position in this array.- Parameters:
index
- index of the value to return- Returns:
- the double value at the specified position in this array
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= size())WrongValueTypeException
- if the value type at the specified index is not numberNumberFormatException
-
getString
public String getString(int index) throws IndexOutOfBoundsException, WrongValueTypeException
Returns a string value at the specified position in this array.- Parameters:
index
- index of the value to return- Returns:
- the string value at the specified position in this array
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= size())WrongValueTypeException
- if the value type at the specified index is not string
-
getArray
public JSONValueArray getArray(int index) throws IndexOutOfBoundsException, WrongValueTypeException
Returns an array value at the specified position in this array.- Parameters:
index
- index of the value to return- Returns:
- the array value at the specified position in this array
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= size())WrongValueTypeException
- if the value type at the specified index is not array
-
getObject
public JSONValueObject getObject(int index) throws IndexOutOfBoundsException, WrongValueTypeException
Returns an object value at the specified position in this array.- Parameters:
index
- index of the value to return- Returns:
- the object value at the specified position in this array
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= size())WrongValueTypeException
- if the value type at the specified index is not object
-
hashCode
public int hashCode()
-
-