|
||||||||||
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>
com.mongodb.BasicDBList
public class BasicDBList
Utility class to allow array DBObject
s to be created.
Note: MongoDB will also create arrays from java.util.List
s.
This simulates the array [ value1, null, value3, null, value2 ] by creating theDBObject obj = new BasicDBList(); obj.put( "0", value1 ); obj.put( "4", value2 ); obj.put( 2, value3 );
DBObject
{ "0" : value1, "1" : null, "2" : value3, "3" : null, "4" : value2 }
.
BasicDBList only supports numeric keys. Passing strings that cannot be converted to ints will cause an IllegalArgumentException.
BasicDBList list = new BasicDBList(); list.put("1", "bar"); // ok list.put("1E1", "bar"); // throws exception
Field Summary |
---|
Fields inherited from class java.util.AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
BasicDBList()
|
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. |
boolean |
isPartialObject()
whether markAsPartialObject was ever called only matters if you are going to upsert and dont' want to risk losing fields |
Set<String> |
keySet()
Returns this object's fields' names |
void |
markAsPartialObject()
if this object was loaded with only some fields (using a field filter) this method will be called to notify |
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(DBObject o)
|
void |
putAll(Map m)
|
Object |
removeField(String key)
Remove a field with a given name from this object. |
Map |
toMap()
Returns a map representing this DBObject. |
Methods inherited from class java.util.ArrayList |
---|
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeRange, retainAll, set, size, subList, toArray, toArray, trimToSize |
Methods inherited from class java.util.AbstractList |
---|
equals, hashCode |
Methods inherited from class java.util.AbstractCollection |
---|
containsAll, 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 |
Constructor Detail |
---|
public BasicDBList()
Method Detail |
---|
public Object put(String key, Object v)
put
in interface DBObject
key
- 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)
putAll
in interface DBObject
public void putAll(DBObject o)
putAll
in interface DBObject
public Object get(String key)
get
in interface DBObject
key
- the index
IllegalArgumentException
- if key
cannot be parsed into an int
public Object removeField(String key)
DBObject
removeField
in interface DBObject
key
- The name of the field to remove
public boolean containsKey(String key)
containsKey
in interface DBObject
public boolean containsField(String key)
DBObject
containsField
in interface DBObject
key
- Field name for which to check
public Set<String> keySet()
DBObject
keySet
in interface DBObject
public Map toMap()
DBObject
toMap
in interface DBObject
public boolean isPartialObject()
DBObject
isPartialObject
in interface DBObject
public void markAsPartialObject()
DBObject
markAsPartialObject
in interface DBObject
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |