|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<Object>
org.bson.types.BasicBSONList
public class BasicBSONList
Utility class to allow array DBObjects to be created.
Note: MongoDB will also create arrays from java.util.Lists.
This simulates the array [ value1, null, value3, null, value2 ] by creating theDBObject obj = new BasicBSONList(); obj.put( "0", value1 ); obj.put( "4", value2 ); obj.put( 2, value3 );
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
| Field Summary |
|---|
| Fields inherited from class java.util.AbstractList |
|---|
modCount |
| Constructor Summary | |
|---|---|
BasicBSONList()
|
|
| Method Summary | |
|---|---|
boolean |
containsField(String key)
Checks if this object contains a field with the given name. |
boolean |
containsKey(String key)
Deprecated. |
Object |
get(String key)
Gets a value at an index. |
Set<String> |
keySet()
Returns this object's fields' names |
Object |
put(int key,
Object v)
Puts a value at an index. |
Object |
put(String key,
Object v)
Puts a value at an index. |
void |
putAll(BSONObject o)
Sets all key/value pairs from an object into this object |
void |
putAll(Map m)
Sets all key/value pairs from a map into this object |
Object |
removeField(String key)
Removes a field with a given name from this object. |
Map |
toMap()
Returns a map representing this BSONObject. |
| Methods inherited from class java.util.ArrayList |
|---|
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize |
| Methods inherited from class java.util.AbstractList |
|---|
equals, hashCode, iterator, listIterator, listIterator, subList |
| Methods inherited from class java.util.AbstractCollection |
|---|
containsAll, removeAll, retainAll, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.List |
|---|
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList |
| Constructor Detail |
|---|
public BasicBSONList()
| Method Detail |
|---|
public Object put(String key,
Object v)
put in interface BSONObjectkey - the index at which to insert the valuev - the value to insert
IllegalArgumentException - if key cannot be parsed into an int
public Object put(int key,
Object v)
index with null.
key - the index at which to insert the valuev - the value to insert
public void putAll(Map m)
BSONObject
putAll in interface BSONObjectm - the mappublic void putAll(BSONObject o)
BSONObject
putAll in interface BSONObjecto - the objectpublic Object get(String key)
get in interface BSONObjectkey - the index
IllegalArgumentException - if key cannot be parsed into an intpublic Object removeField(String key)
BSONObject
removeField in interface BSONObjectkey - The name of the field to remove
@Deprecated public boolean containsKey(String key)
BSONObject
containsKey in interface BSONObjectpublic boolean containsField(String key)
BSONObject
containsField in interface BSONObjectkey - Field name for which to check
public Set<String> keySet()
BSONObject
keySet in interface BSONObjectpublic Map toMap()
BSONObject
toMap in interface BSONObject
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||