Package org.bson
Class BsonArray
- java.lang.Object
-
- org.bson.BsonValue
-
- org.bson.BsonArray
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, BsonValue element)
boolean
add(BsonValue bsonValue)
boolean
addAll(int index, Collection<? extends BsonValue> c)
boolean
addAll(Collection<? extends BsonValue> c)
void
clear()
BsonArray
clone()
boolean
contains(Object o)
boolean
containsAll(Collection<?> c)
boolean
equals(Object o)
BsonValue
get(int index)
BsonType
getBsonType()
Gets the BSON type of this value.List<BsonValue>
getValues()
Gets the values in this array as a list ofBsonValue
objects.int
hashCode()
int
indexOf(Object o)
boolean
isEmpty()
Iterator<BsonValue>
iterator()
int
lastIndexOf(Object o)
ListIterator<BsonValue>
listIterator()
ListIterator<BsonValue>
listIterator(int index)
static BsonArray
parse(String json)
Parses a string in MongoDB Extended JSON format to aBsonArray
BsonValue
remove(int index)
boolean
remove(Object o)
boolean
removeAll(Collection<?> c)
boolean
retainAll(Collection<?> c)
BsonValue
set(int index, BsonValue element)
int
size()
List<BsonValue>
subList(int fromIndex, int toIndex)
Object[]
toArray()
<T> T[]
toArray(T[] a)
String
toString()
-
Methods inherited from class org.bson.BsonValue
asArray, asBinary, asBoolean, asDateTime, asDBPointer, asDecimal128, asDocument, asDouble, asInt32, asInt64, asJavaScript, asJavaScriptWithScope, asNumber, asObjectId, asRegularExpression, asString, asSymbol, asTimestamp, isArray, isBinary, isBoolean, isDateTime, isDBPointer, isDecimal128, isDocument, isDouble, isInt32, isInt64, isJavaScript, isJavaScriptWithScope, isNull, isNumber, isObjectId, isRegularExpression, isString, isSymbol, isTimestamp
-
Methods inherited from class java.lang.Object
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
replaceAll, sort, spliterator
-
-
-
-
Constructor Detail
-
BsonArray
public BsonArray(List<? extends BsonValue> values)
Construct an instance with the given list of values.- Parameters:
values
- the list of values, none of whose members may be null.
-
BsonArray
public BsonArray()
Construct an empty BsonArray
-
BsonArray
public BsonArray(int initialCapacity)
Construct an empty BsonArray with the specified initial capacity.- Parameters:
initialCapacity
- the initial capacity of the BsonArray- Throws:
IllegalArgumentException
- if the specified initial capacity is negative- Since:
- 4.3
-
-
Method Detail
-
parse
public static BsonArray parse(String json)
Parses a string in MongoDB Extended JSON format to aBsonArray
- Parameters:
json
- the JSON string- Returns:
- a corresponding
BsonArray
object - Since:
- 3.4
- See Also:
JsonReader
- MongoDB documentation
- MongoDB Extended JSON
-
getValues
public List<BsonValue> getValues()
Gets the values in this array as a list ofBsonValue
objects.- Returns:
- the values in this array.
-
getBsonType
public BsonType getBsonType()
Description copied from class:BsonValue
Gets the BSON type of this value.- Specified by:
getBsonType
in classBsonValue
- Returns:
- the BSON type, which may not be null (but may be BSONType.NULL)
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
contains
public boolean contains(Object o)
-
toArray
public Object[] toArray()
-
toArray
public <T> T[] toArray(T[] a)
-
add
public boolean add(BsonValue bsonValue)
-
remove
public boolean remove(Object o)
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAll
in interfaceCollection<BsonValue>
- Specified by:
containsAll
in interfaceList<BsonValue>
-
addAll
public boolean addAll(Collection<? extends BsonValue> c)
-
addAll
public boolean addAll(int index, Collection<? extends BsonValue> c)
-
removeAll
public boolean removeAll(Collection<?> c)
-
retainAll
public boolean retainAll(Collection<?> c)
-
clear
public void clear()
-
lastIndexOf
public int lastIndexOf(Object o)
- Specified by:
lastIndexOf
in interfaceList<BsonValue>
-
listIterator
public ListIterator<BsonValue> listIterator()
- Specified by:
listIterator
in interfaceList<BsonValue>
-
listIterator
public ListIterator<BsonValue> listIterator(int index)
- Specified by:
listIterator
in interfaceList<BsonValue>
-
equals
public boolean equals(Object o)
-
hashCode
public int hashCode()
-
-