Package org.apache.johnzon.core
Class JsonArrayImpl
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<jakarta.json.JsonValue>
-
- org.apache.johnzon.core.JsonArrayImpl
-
- All Implemented Interfaces:
jakarta.json.JsonArray
,jakarta.json.JsonStructure
,jakarta.json.JsonValue
,Serializable
,Iterable<jakarta.json.JsonValue>
,Collection<jakarta.json.JsonValue>
,List<jakarta.json.JsonValue>
class JsonArrayImpl extends AbstractList<jakarta.json.JsonValue> implements jakarta.json.JsonArray, Serializable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
JsonArrayImpl.JsonArrayIterator
We don't need any range check, so we can simplify the Iterator logic.
-
Field Summary
Fields Modifier and Type Field Description private Integer
hashCode
private BufferStrategy.BufferProvider<char[]>
provider
private int
size
private List<jakarta.json.JsonValue>
unmodifieableBackingList
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description JsonArrayImpl(List<jakarta.json.JsonValue> backingList, BufferStrategy.BufferProvider<char[]> provider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
jakarta.json.JsonValue
get(int index)
boolean
getBoolean(int index)
boolean
getBoolean(int index, boolean defaultValue)
int
getInt(int index)
int
getInt(int index, int defaultValue)
jakarta.json.JsonArray
getJsonArray(int index)
jakarta.json.JsonNumber
getJsonNumber(int index)
jakarta.json.JsonObject
getJsonObject(int index)
jakarta.json.JsonString
getJsonString(int index)
String
getString(int index)
String
getString(int index, String defaultValue)
<T extends jakarta.json.JsonValue>
List<T>getValuesAs(Class<T> clazz)
jakarta.json.JsonValue.ValueType
getValueType()
int
hashCode()
boolean
isNull(int index)
Iterator<jakarta.json.JsonValue>
iterator()
int
size()
String
toString()
private <T> T
value(int idx, Class<T> type)
private Object
writeReplace()
-
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, indexOf, isEmpty, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, sort, spliterator, subList, toArray, toArray
-
-
-
-
Field Detail
-
provider
private final BufferStrategy.BufferProvider<char[]> provider
-
hashCode
private Integer hashCode
-
unmodifieableBackingList
private final List<jakarta.json.JsonValue> unmodifieableBackingList
-
size
private int size
-
-
Constructor Detail
-
JsonArrayImpl
JsonArrayImpl(List<jakarta.json.JsonValue> backingList, BufferStrategy.BufferProvider<char[]> provider)
-
-
Method Detail
-
value
private <T> T value(int idx, Class<T> type)
-
getJsonObject
public jakarta.json.JsonObject getJsonObject(int index)
- Specified by:
getJsonObject
in interfacejakarta.json.JsonArray
-
getJsonArray
public jakarta.json.JsonArray getJsonArray(int index)
- Specified by:
getJsonArray
in interfacejakarta.json.JsonArray
-
getJsonNumber
public jakarta.json.JsonNumber getJsonNumber(int index)
- Specified by:
getJsonNumber
in interfacejakarta.json.JsonArray
-
getJsonString
public jakarta.json.JsonString getJsonString(int index)
- Specified by:
getJsonString
in interfacejakarta.json.JsonArray
-
getValuesAs
public <T extends jakarta.json.JsonValue> List<T> getValuesAs(Class<T> clazz)
- Specified by:
getValuesAs
in interfacejakarta.json.JsonArray
-
getString
public String getString(int index)
- Specified by:
getString
in interfacejakarta.json.JsonArray
-
getString
public String getString(int index, String defaultValue)
- Specified by:
getString
in interfacejakarta.json.JsonArray
-
getInt
public int getInt(int index)
- Specified by:
getInt
in interfacejakarta.json.JsonArray
-
getInt
public int getInt(int index, int defaultValue)
- Specified by:
getInt
in interfacejakarta.json.JsonArray
-
getBoolean
public boolean getBoolean(int index)
- Specified by:
getBoolean
in interfacejakarta.json.JsonArray
-
getBoolean
public boolean getBoolean(int index, boolean defaultValue)
- Specified by:
getBoolean
in interfacejakarta.json.JsonArray
-
isNull
public boolean isNull(int index)
- Specified by:
isNull
in interfacejakarta.json.JsonArray
-
getValueType
public jakarta.json.JsonValue.ValueType getValueType()
- Specified by:
getValueType
in interfacejakarta.json.JsonValue
-
toString
public String toString()
- Specified by:
toString
in interfacejakarta.json.JsonValue
- Overrides:
toString
in classAbstractCollection<jakarta.json.JsonValue>
-
equals
public boolean equals(Object obj)
- Specified by:
equals
in interfaceCollection<jakarta.json.JsonValue>
- Specified by:
equals
in interfaceList<jakarta.json.JsonValue>
- Overrides:
equals
in classAbstractList<jakarta.json.JsonValue>
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceCollection<jakarta.json.JsonValue>
- Specified by:
hashCode
in interfaceList<jakarta.json.JsonValue>
- Overrides:
hashCode
in classAbstractList<jakarta.json.JsonValue>
-
get
public jakarta.json.JsonValue get(int index)
- Specified by:
get
in interfaceList<jakarta.json.JsonValue>
- Specified by:
get
in classAbstractList<jakarta.json.JsonValue>
-
size
public int size()
- Specified by:
size
in interfaceCollection<jakarta.json.JsonValue>
- Specified by:
size
in interfaceList<jakarta.json.JsonValue>
- Specified by:
size
in classAbstractCollection<jakarta.json.JsonValue>
-
writeReplace
private Object writeReplace() throws ObjectStreamException
- Throws:
ObjectStreamException
-
iterator
public Iterator<jakarta.json.JsonValue> iterator()
- Specified by:
iterator
in interfaceCollection<jakarta.json.JsonValue>
- Specified by:
iterator
in interfaceIterable<jakarta.json.JsonValue>
- Specified by:
iterator
in interfaceList<jakarta.json.JsonValue>
- Overrides:
iterator
in classAbstractList<jakarta.json.JsonValue>
-
-