Package org.bson
Interface BSONObject
-
- All Known Subinterfaces:
DBObject
- All Known Implementing Classes:
BasicBSONList
,BasicBSONObject
,BasicDBList
,BasicDBObject
,CommandResult
,GridFSDBFile
,GridFSFile
,GridFSInputFile
,LazyBSONList
,LazyBSONObject
,LazyDBList
,LazyDBObject
,ReflectionDBObject
public interface BSONObject
A key-value map that can be saved to the database.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description boolean
s)
Checks if this object contains a field with the given name.boolean
key)
Deprecated.Please usecontainsField(String)
insteadkey)
Gets a field from this object by a given name.<>
keySet()
Returns this object's fields' nameskey, v)
Sets a name/value pair in this object.void
m)
Sets all key/value pairs from a map into this objectvoid
putAll(BSONObject o)
Sets all key/value pairs from an object into this objectkey)
Removes a field with a given name from this object.toMap()
Returns a map representing this BSONObject.
-
-
-
Method Detail
-
put
put( key, v)
Sets a name/value pair in this object.- Parameters:
key
- Name to setv
- Corresponding value- Returns:
- the previous value associated with
key
, ornull
if there was no mapping forkey
. (Anull
return can also indicate that the map previously associatednull
withkey
.)
-
putAll
void putAll(BSONObject o)
Sets all key/value pairs from an object into this object- Parameters:
o
- the object
-
putAll
void putAll( m)
Sets all key/value pairs from a map into this object- Parameters:
m
- the map
-
get
get( key)
Gets a field from this object by a given name.- Parameters:
key
- The name of the field fetch- Returns:
- The field, if found
-
toMap
toMap()
Returns a map representing this BSONObject.- Returns:
- the map
-
removeField
removeField( 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
-
containsKey
boolean containsKey( key)
Deprecated.Please usecontainsField(String)
insteadDeprecated- Parameters:
key
- the key to check- Returns:
- True if the key is present
-
containsField
boolean containsField( s)
Checks if this object contains a field with the given name.- Parameters:
s
- Field name for which to check- Returns:
- True if the field is present
-
keySet
<> keySet()
Returns this object's fields' names- Returns:
- The names of the fields in this object
-
-