public interface DBBson
extends java.sql.SQLData, org.bson.BSONObject, java.util.Map<java.lang.String,java.lang.Object>
| Modifier and Type | Method and Description |
|---|---|
DBBson |
append(java.lang.String key,
java.lang.Object value)
Append the key/value pair to this document
Similar to {
BSONObject.put(String, Object) but this method returns the class reference
to make multiple appends easier to write |
boolean |
containsField(java.lang.String s) |
boolean |
containsKey(java.lang.String s) |
void |
ensureRawDocument() |
byte[] |
getBytes() |
org.bson.Document |
getDocument()
Return the Map version of the Bson document
This version takes more memory but is completely manipulatable as you would a Map
This returns a reference to the document object contained in this object.
|
org.bson.Document |
getDocument(boolean recursive)
Return the Map version of the Bson document
This version takes more memory but is completely manipulatable as you would a Map
This returns a reference to the document object contained in this object.
|
DBBson |
getDocument(java.lang.String key)
Returns a subdocument from this document
|
double |
getDouble(java.lang.String key)
Returns the double value of the key in the document
|
java.lang.String |
getFirstKey()
Return the first key from the document
|
int |
getInt(java.lang.String key)
Returns the int value of the key in the document
|
org.bson.json.JsonMode |
getJsonFormat() |
long |
getLong(java.lang.String key)
Returns the long value of the key in the document
|
org.bson.RawBsonDocument |
getRawDocument()
Return the reference to the raw document
If you get this object, this is a reference only, if you decided to modify this object later or the raw document
take care as they can become out of sync.
|
java.lang.String |
getString(java.lang.String key)
Returns the string value of the key in the document
|
boolean |
isRawDocument()
Returns whether we are currently a raw document or a fully exploded java map
|
void |
putAll(org.bson.BSONObject o) |
java.lang.Object |
removeField(java.lang.String key) |
void |
setBSONObject(org.bson.BSONObject bsonObject) |
void |
setBytes(byte[] bytes)
Assigns the BSON-encoded byte array representation of a document.
|
void |
setDocument(org.bson.Document bsonObject)
Assigns the BSONObject this object represents.
|
DBBson |
setJsonFormat(org.bson.json.JsonMode mode) |
void |
setRawDocument(org.bson.RawBsonDocument doc) |
java.lang.String |
toJson()
Returns a compact form of JSON
Does not have a pretty-print or any extraneous whitespace
|
java.util.Map<java.lang.String,java.lang.Object> |
toMap() |
void ensureRawDocument()
byte[] getBytes()
void setBytes(byte[] bytes)
null.bytes - the BSON-encoded byte array representation of a documentvoid setRawDocument(org.bson.RawBsonDocument doc)
void setDocument(org.bson.Document bsonObject)
null.bsonObject - the documentjava.lang.NullPointerException - if the bsonObject is nullvoid setBSONObject(org.bson.BSONObject bsonObject)
java.lang.String toJson()
java.util.Map<java.lang.String,java.lang.Object> toMap()
toMap in interface org.bson.BSONObjectboolean containsKey(java.lang.String s)
containsKey in interface org.bson.BSONObjectboolean containsField(java.lang.String s)
containsField in interface org.bson.BSONObjectorg.bson.Document getDocument()
org.bson.Document getDocument(boolean recursive)
recursive - boolean indicating whether it should recursively turn any sub-doucments into maps as wellDBBson getDocument(java.lang.String key)
key - field to search fororg.bson.RawBsonDocument getRawDocument()
DBBson append(java.lang.String key, java.lang.Object value)
BSONObject.put(String, Object) but this method returns the class reference
to make multiple appends easier to writekey - Key to setvalue - Object to setint getInt(java.lang.String key)
key - Key to lookuplong getLong(java.lang.String key)
key - Key to lookupdouble getDouble(java.lang.String key)
key - Key to lookupjava.lang.String getString(java.lang.String key)
key - Key to lookupboolean isRawDocument()
true if we are are a raw documentjava.lang.String getFirstKey()
void putAll(org.bson.BSONObject o)
putAll in interface org.bson.BSONObjectjava.lang.Object removeField(java.lang.String key)
removeField in interface org.bson.BSONObjectDBBson setJsonFormat(org.bson.json.JsonMode mode)
org.bson.json.JsonMode getJsonFormat()