Package org.bson
Class BsonArray
-
- org.bson.BsonValue
-
- org.bson.BsonArray
-
- All Implemented Interfaces:
,
<<<BsonValue>
- Direct Known Subclasses:
RawBsonArray
public class BsonArray extends BsonValue implements <
A type-safe representation of the BSON array type.- Since:
- 3.0
-
-
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, <? extends BsonValue> c)
boolean
<? extends BsonValue> c)
void
clear()
BsonArray
clone()
boolean
o)
boolean
<?> c)
boolean
o)
BsonValue
get(int index)
BsonType
getBsonType()
Gets the BSON type of this value.<BsonValue>
getValues()
Gets the values in this array as a list ofBsonValue
objects.int
hashCode()
int
o)
boolean
isEmpty()
<BsonValue>
iterator()
int
o)
<BsonValue>
listIterator()
<BsonValue>
listIterator(int index)
static BsonArray
json)
Parses a string in MongoDB Extended JSON format to aBsonArray
BsonValue
remove(int index)
boolean
o)
boolean
<?> c)
boolean
<?> c)
BsonValue
set(int index, BsonValue element)
int
size()
<BsonValue>
subList(int fromIndex, int toIndex)
[]
toArray()
<T> T[]
toArray(T[] a)
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
-
-
-
-
Constructor Detail
-
BsonArray
public BsonArray(<? 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
-
-
Method Detail
-
parse
public static 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
-
getValues
public <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( o)
-
iterator
public <BsonValue> iterator()
-
toArray
public [] toArray()
-
toArray
public <T> T[] toArray(T[] a)
-
add
public boolean add(BsonValue bsonValue)
-
remove
public boolean remove( o)
-
containsAll
public boolean containsAll(<?> c)
-
addAll
public boolean addAll(<? extends BsonValue> c)
-
addAll
public boolean addAll(int index, <? extends BsonValue> c)
- Specified by:
in interface
<BsonValue>
-
removeAll
public boolean removeAll(<?> c)
-
retainAll
public boolean retainAll(<?> c)
-
clear
public void clear()
-
indexOf
public int indexOf( o)
- Specified by:
in interface
<BsonValue>
-
lastIndexOf
public int lastIndexOf( o)
- Specified by:
in interface
<BsonValue>
-
subList
public <BsonValue> subList(int fromIndex, int toIndex)
- Specified by:
in interface
<BsonValue>
-
equals
public boolean equals( o)
-
hashCode
public int hashCode()
-
toString
public toString()
- Overrides:
in class
-
clone
public BsonArray clone()
- Overrides:
in class
-
-