Package org.bson
Class BasicBSONObject
- All Implemented Interfaces:
Serializable,Cloneable,Map<String,,Object> SequencedMap<String,,Object> BSONObject
- Direct Known Subclasses:
BasicDBObject
@Deprecated(since="2022-10-31")
public class BasicBSONObject
extends LinkedHashMap<String,Object>
implements BSONObject
Deprecated.
Usage of this API is not supported in AEM as a Cloud Service.
A simple implementation of
DBObject. A DBObject can be created as follows, using this class: DBObject obj = new
BasicBSONObject(); obj.put( "foo", "bar" ); - See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Creates an empty object.BasicBSONObject(int size) Deprecated.Creates an empty object.BasicBSONObject(String key, Object value) Deprecated.Creates a BSONObject initialised with a single key/value pair.BasicBSONObject(Map map) Deprecated.Creates a DBObject from a map. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Add a key/value pair to this objectbooleancontainsField(String field) Deprecated.Checks if this object contains a given fieldbooleancontainsKey(String key) Deprecated.booleanDeprecated.Compares two documents according to their serialized form, ignoring the order of keys.Deprecated.Gets a value from this objectbooleangetBoolean(String key) Deprecated.Returns the value of a field as a boolean.booleangetBoolean(String key, boolean def) Deprecated.Returns the value of a field as a booleanDeprecated.Returns the date or null if not set.Deprecated.Returns the date or def if not set.doubleDeprecated.Returns the value of a field as adouble.doubleDeprecated.Returns the value of a field as andouble.intDeprecated.Returns the value of a field as anint.intDeprecated.Returns the value of a field as anint.longDeprecated.Returns the value of a field as along.longDeprecated.Returns the value of a field as anlong.getObjectId(String field) Deprecated.Returns the object id or null if not set.getObjectId(String field, ObjectId def) Deprecated.Returns the object id or def if not set.Deprecated.Returns the value of a field as a stringDeprecated.Returns the value of a field as a stringinthashCode()Deprecated.voidDeprecated.Sets all key/value pairs from a map into this objectvoidputAll(BSONObject o) Deprecated.Sets all key/value pairs from an object into this objectremoveField(String key) Deprecated.Deletes a field from this object.toMap()Deprecated.Converts a DBObject to a map.Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, newLinkedHashMap, putFirst, putLast, replaceAll, reversed, sequencedEntrySet, sequencedKeySet, sequencedValues, valuesMethods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, newHashMap, put, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from class java.util.AbstractMap
toStringMethods inherited from interface org.bson.BSONObject
keySet, putMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from interface java.util.SequencedMap
firstEntry, lastEntry, pollFirstEntry, pollLastEntry
-
Constructor Details
-
BasicBSONObject
public BasicBSONObject()Deprecated.Creates an empty object. -
BasicBSONObject
public BasicBSONObject(int size) Deprecated.Creates an empty object.- Parameters:
size- the initial capacity for the Map storing this document.
-
BasicBSONObject
Deprecated.Creates a BSONObject initialised with a single key/value pair.- Parameters:
key- key under which to storevalue- value to store
-
BasicBSONObject
Deprecated.Creates a DBObject from a map.- Parameters:
map- map to convert
-
-
Method Details
-
toMap
Deprecated.Converts a DBObject to a map.- Specified by:
toMapin interfaceBSONObject- Returns:
- the DBObject
-
removeField
Deprecated.Deletes a field from this object.- Specified by:
removeFieldin interfaceBSONObject- Parameters:
key- the field name to remove- Returns:
- the object removed
-
containsField
Deprecated.Checks if this object contains a given field- Specified by:
containsFieldin interfaceBSONObject- Parameters:
field- field name- Returns:
- if the field exists
-
containsKey
Deprecated.Description copied from interface:BSONObjectDeprecated- Specified by:
containsKeyin interfaceBSONObject- Parameters:
key- the key to check- Returns:
- True if the key is present
-
get
Deprecated.Gets a value from this object- Specified by:
getin interfaceBSONObject- Parameters:
key- field name- Returns:
- the value
-
getInt
Deprecated.Returns the value of a field as anint.- Parameters:
key- the field to look for- Returns:
- the field value (or default)
-
getInt
Deprecated.Returns the value of a field as anint.- Parameters:
key- the field to look fordef- the default to return- Returns:
- the field value (or default)
-
getLong
Deprecated.Returns the value of a field as along.- Parameters:
key- the field to return- Returns:
- the field value
-
getLong
Deprecated.Returns the value of a field as anlong.- Parameters:
key- the field to look fordef- the default to return- Returns:
- the field value (or default)
-
getDouble
Deprecated.Returns the value of a field as adouble.- Parameters:
key- the field to return- Returns:
- the field value
-
getDouble
Deprecated.Returns the value of a field as andouble.- Parameters:
key- the field to look fordef- the default to return- Returns:
- the field value (or default)
-
getString
Deprecated.Returns the value of a field as a string- Parameters:
key- the field to look up- Returns:
- the value of the field, converted to a string
-
getString
Deprecated.Returns the value of a field as a string- Parameters:
key- the field to look updef- the default to return- Returns:
- the value of the field, converted to a string
-
getBoolean
Deprecated.Returns the value of a field as a boolean.- Parameters:
key- the field to look up- Returns:
- the value of the field, or false if field does not exist
-
getBoolean
Deprecated.Returns the value of a field as a boolean- Parameters:
key- the field to look updef- the default value in case the field is not found- Returns:
- the value of the field, converted to a string
-
getObjectId
Deprecated.Returns the object id or null if not set.- Parameters:
field- The field to return- Returns:
- The field object value or null if not found (or if null :-^).
-
getObjectId
Deprecated.Returns the object id or def if not set.- Parameters:
field- The field to returndef- the default value in case the field is not found- Returns:
- The field object value or def if not set.
-
getDate
Deprecated.Returns the date or null if not set.- Parameters:
field- The field to return- Returns:
- The field object value or null if not found.
-
getDate
Deprecated.Returns the date or def if not set.- Parameters:
field- The field to returndef- the default value in case the field is not found- Returns:
- The field object value or def if not set.
-
putAll
Deprecated.Description copied from interface:BSONObjectSets all key/value pairs from a map into this object -
putAll
Deprecated.Description copied from interface:BSONObjectSets all key/value pairs from an object into this object- Specified by:
putAllin interfaceBSONObject- Parameters:
o- the object
-
append
Deprecated.Add a key/value pair to this object- Parameters:
key- the field nameval- the field value- Returns:
this
-
equals
Deprecated.Compares two documents according to their serialized form, ignoring the order of keys.- Specified by:
equalsin interfaceMap<String,Object> - Overrides:
equalsin classAbstractMap<String,Object> - Parameters:
o- the document to compare to, which must be an instance ofBSONObject.- Returns:
- true if the documents have the same serialized form, ignoring key order.
-
hashCode
public int hashCode()Deprecated.
-