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 booleanadd(boolean value)Add a JSON boolean value to this array.booleanadd(double value)Add a JSON number value to this array.abstract voidadd(int i, JSONValue jsonValue)booleanadd(long value)Add a JSON number value to this array.abstract booleanadd(JSONValue jsonValue)booleanadd(String value)Add a JSON string value to this array.abstract booleanaddAll(int i, @NotNull Collection<? extends JSONValue> collection)abstract booleanaddAll(@NotNull Collection<? extends JSONValue> collection)abstract voidclear()abstract booleancontains(Object o)abstract booleancontainsAll(@NotNull Collection<?> collection)booleanequals(Object o)abstract JSONValueget(int i)JSONValueArraygetArray(int index)Returns an array value at the specified position in this array.booleangetBoolean(int index)Returns a boolean value at the specified position in this array.doublegetDouble(int index)Returns a number value at the specified position in this array.longgetLong(int index)Returns a number value at the specified position in this array.JSONValueObjectgetObject(int index)Returns an object value at the specified position in this array.StringgetString(int index)Returns a string value at the specified position in this array.inthashCode()abstract intindexOf(Object o)abstract booleanisEmpty()abstract @NotNull Iterator<JSONValue>iterator()abstract intlastIndexOf(Object o)abstract @NotNull ListIterator<JSONValue>listIterator()abstract @NotNull ListIterator<JSONValue>listIterator(int i)abstract JSONValueremove(int i)abstract booleanremove(Object o)abstract booleanremoveAll(@NotNull Collection<?> collection)abstract booleanretainAll(@NotNull Collection<?> collection)abstract JSONValueset(int i, JSONValue jsonValue)abstract intsize()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:
lastIndexOfin interfaceList<JSONValue>
-
listIterator
@NotNull public abstract @NotNull ListIterator<JSONValue> listIterator()
- Specified by:
listIteratorin interfaceList<JSONValue>
-
listIterator
@NotNull public abstract @NotNull ListIterator<JSONValue> listIterator(int i)
- Specified by:
listIteratorin 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:
containsAllin interfaceCollection<JSONValue>- Specified by:
containsAllin 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, WrongValueTypeExceptionReturns 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, NumberFormatExceptionReturns 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, NumberFormatExceptionReturns 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()
-
-