Known Direct Subclasses
BasicDBList |
a basic implementation of bson list that is mongo specific |
|
Class Overview
Utility class to allow array DBObject
s to be created.
Note: MongoDB will also create arrays from java.util.List
s.
DBObject obj = new BasicBSONList();
obj.put( "0", value1 );
obj.put( "4", value2 );
obj.put( 2, value3 );
This simulates the array [ value1, null, value3, null, value2 ] by creating the
DBObject
{ "0" : value1, "1" : null, "2" : value3, "3" : null, "4" : value2 }
.
BasicBSONList only supports numeric keys. Passing strings that cannot be converted to ints will cause an
IllegalArgumentException.
BasicBSONList list = new BasicBSONList();
list.put("1", "bar"); // ok
list.put("1E1", "bar"); // throws exception
Summary
[Expand]
Inherited Fields |
From class
java.util.AbstractList
|
[Expand]
Inherited Methods |
From class
java.util.ArrayList
boolean
|
add(E arg0)
|
void
|
add(int arg0, E arg1)
|
boolean
|
addAll(Collection<? extends E> arg0)
|
boolean
|
addAll(int arg0, Collection<? extends E> arg1)
|
void
|
clear()
|
Object
|
clone()
|
boolean
|
contains(Object arg0)
|
void
|
ensureCapacity(int arg0)
|
E
|
get(int arg0)
|
int
|
indexOf(Object arg0)
|
boolean
|
isEmpty()
|
int
|
lastIndexOf(Object arg0)
|
E
|
remove(int arg0)
|
boolean
|
remove(Object arg0)
|
void
|
removeRange(int arg0, int arg1)
|
E
|
set(int arg0, E arg1)
|
int
|
size()
|
<T>
T[]
|
toArray(T[] arg0)
|
Object[]
|
toArray()
|
void
|
trimToSize()
|
|
From class
java.util.AbstractList
boolean
|
add(E arg0)
|
void
|
add(int arg0, E arg1)
|
boolean
|
addAll(int arg0, Collection<? extends E> arg1)
|
void
|
clear()
|
boolean
|
equals(Object arg0)
|
abstract
E
|
get(int arg0)
|
int
|
hashCode()
|
int
|
indexOf(Object arg0)
|
Iterator<E>
|
iterator()
|
int
|
lastIndexOf(Object arg0)
|
ListIterator<E>
|
listIterator(int arg0)
|
ListIterator<E>
|
listIterator()
|
E
|
remove(int arg0)
|
void
|
removeRange(int arg0, int arg1)
|
E
|
set(int arg0, E arg1)
|
List<E>
|
subList(int arg0, int arg1)
|
|
From class
java.util.AbstractCollection
boolean
|
add(E arg0)
|
boolean
|
addAll(Collection<? extends E> arg0)
|
void
|
clear()
|
boolean
|
contains(Object arg0)
|
boolean
|
containsAll(Collection<?> arg0)
|
boolean
|
isEmpty()
|
abstract
Iterator<E>
|
iterator()
|
boolean
|
remove(Object arg0)
|
boolean
|
removeAll(Collection<?> arg0)
|
boolean
|
retainAll(Collection<?> arg0)
|
abstract
int
|
size()
|
<T>
T[]
|
toArray(T[] arg0)
|
Object[]
|
toArray()
|
String
|
toString()
|
|
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
|
From interface
java.lang.Iterable
|
From interface
java.util.Collection
abstract
boolean
|
add(E arg0)
|
abstract
boolean
|
addAll(Collection<? extends E> arg0)
|
abstract
void
|
clear()
|
abstract
boolean
|
contains(Object arg0)
|
abstract
boolean
|
containsAll(Collection<?> arg0)
|
abstract
boolean
|
equals(Object arg0)
|
abstract
int
|
hashCode()
|
abstract
boolean
|
isEmpty()
|
abstract
Iterator<E>
|
iterator()
|
abstract
boolean
|
remove(Object arg0)
|
abstract
boolean
|
removeAll(Collection<?> arg0)
|
abstract
boolean
|
retainAll(Collection<?> arg0)
|
abstract
int
|
size()
|
abstract
<T>
T[]
|
toArray(T[] arg0)
|
abstract
Object[]
|
toArray()
|
|
From interface
java.util.List
abstract
boolean
|
add(E arg0)
|
abstract
void
|
add(int arg0, E arg1)
|
abstract
boolean
|
addAll(Collection<? extends E> arg0)
|
abstract
boolean
|
addAll(int arg0, Collection<? extends E> arg1)
|
abstract
void
|
clear()
|
abstract
boolean
|
contains(Object arg0)
|
abstract
boolean
|
containsAll(Collection<?> arg0)
|
abstract
boolean
|
equals(Object arg0)
|
abstract
E
|
get(int arg0)
|
abstract
int
|
hashCode()
|
abstract
int
|
indexOf(Object arg0)
|
abstract
boolean
|
isEmpty()
|
abstract
Iterator<E>
|
iterator()
|
abstract
int
|
lastIndexOf(Object arg0)
|
abstract
ListIterator<E>
|
listIterator(int arg0)
|
abstract
ListIterator<E>
|
listIterator()
|
abstract
E
|
remove(int arg0)
|
abstract
boolean
|
remove(Object arg0)
|
abstract
boolean
|
removeAll(Collection<?> arg0)
|
abstract
boolean
|
retainAll(Collection<?> arg0)
|
abstract
E
|
set(int arg0, E arg1)
|
abstract
int
|
size()
|
abstract
List<E>
|
subList(int arg0, int arg1)
|
abstract
<T>
T[]
|
toArray(T[] arg0)
|
abstract
Object[]
|
toArray()
|
|
From interface
org.bson.BSONObject
abstract
boolean
|
containsField(String s)
Checks if this object contains a field with the given name.
|
abstract
boolean
|
containsKey(String s)
This method is deprecated.
No replacement.
|
abstract
Object
|
get(String key)
Gets a field from this object by a given name.
|
abstract
Set<String>
|
keySet()
Returns this object's fields' names
|
abstract
Object
|
put(String key, Object v)
Sets a name/value pair in this object.
|
abstract
void
|
putAll(BSONObject o)
Sets all key/value pairs from an object into this object
|
abstract
void
|
putAll(Map m)
Sets all key/value pairs from a map into this object
|
abstract
Object
|
removeField(String key)
Removes a field with a given name from this object.
|
abstract
Map
|
toMap()
Returns a map representing this BSONObject.
|
|
Public Constructors
Public Methods
public
boolean
containsField
(String key)
Checks if this object contains a field with the given name.
Parameters
key
| Field name for which to check |
Returns
- True if the field is present
public
boolean
containsKey
(String key)
This method is deprecated.
No replacement.
Returns
- True if the key is present
Gets a value at an index.
For interface compatibility. Must be passed a String that is parsable to an int.
Returns
- the value, if found, or null
public
Set<String>
keySet
()
Returns this object's fields' names
Returns
- The names of the fields in this object
Puts a value at an index.
For interface compatibility. Must be passed a String that is parsable to an int.
Parameters
key
| the index at which to insert the value |
v
| the value to insert |
public
Object
put
(int key, Object v)
Puts a value at an index.
This will fill any unset indexes less than index
with null
.
Parameters
key
| the index at which to insert the value |
v
| the value to insert |
public
void
putAll
(BSONObject o)
Sets all key/value pairs from an object into this object
public
void
putAll
(Map m)
Sets all key/value pairs from a map into this object
public
Object
removeField
(String key)
Removes a field with a given name from this object.
Parameters
key
| The name of the field to remove |
Returns
- The value removed from this object
public
Map
toMap
()
Returns a map representing this BSONObject.