public interface

BSONObject

org.bson.BSONObject
Known Indirect Subclasses

Class Overview

A key-value map that can be saved to the database.

Summary

Public Methods
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 Methods

public abstract boolean containsField (String 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

public abstract boolean containsKey (String s)

This method is deprecated.
No replacement.

Deprecated

Returns
  • True if the key is present

public abstract Object get (String key)

Gets a field from this object by a given name.

Parameters
key The name of the field fetch
Returns
  • The field, if found

public abstract Set<String> keySet ()

Returns this object's fields' names

Returns
  • The names of the fields in this object

public abstract Object put (String key, Object v)

Sets a name/value pair in this object.

Parameters
key Name to set
v Corresponding value
Returns
  • v

public abstract void putAll (BSONObject o)

Sets all key/value pairs from an object into this object

Parameters
o the object

public abstract void putAll (Map m)

Sets all key/value pairs from a map into this object

Parameters
m the map

public abstract 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 abstract Map toMap ()

Returns a map representing this BSONObject.

Returns
  • the map