public final class RawBsonDocument extends BsonDocument
Constructor | Description |
---|---|
RawBsonDocument(byte[] bytes) |
Constructs a new instance with the given byte array.
|
RawBsonDocument(byte[] bytes,
int offset,
int length) |
Constructs a new instance with the given byte array, offset, and length.
|
RawBsonDocument(T document,
Codec<T> codec) |
Construct a new instance from the given document and codec for the document type.
|
Modifier and Type | Method | Description |
---|---|---|
BsonDocument |
append(String key,
BsonValue value) |
Put the given key and value into this document, and return the document.
|
void |
clear() |
|
BsonDocument |
clone() |
|
boolean |
containsKey(Object key) |
|
boolean |
containsValue(Object value) |
|
<T> T |
decode(Codec<T> codec) |
Decode this into a document.
|
<T> T |
decode(Decoder<T> decoder) |
Decode this into a document.
|
Set<Map.Entry<String,BsonValue>> |
entrySet() |
|
boolean |
equals(Object o) |
|
BsonValue |
get(Object key) |
|
ByteBuf |
getByteBuffer() |
Returns a
ByteBuf that wraps the byte array, with the proper byte order. |
String |
getFirstKey() |
Gets the first key in the document.
|
int |
hashCode() |
|
boolean |
isEmpty() |
|
Set<String> |
keySet() |
|
static RawBsonDocument |
parse(String json) |
Parses a string in MongoDB Extended JSON format to a
RawBsonDocument |
BsonValue |
put(String key,
BsonValue value) |
|
void |
putAll(Map<? extends String,? extends BsonValue> m) |
|
BsonValue |
remove(Object key) |
|
int |
size() |
|
String |
toJson() |
Gets a JSON representation of this document using the
JsonMode.STRICT output mode, and otherwise the default
settings of JsonWriterSettings.Builder . |
String |
toJson(JsonWriterSettings settings) |
Gets a JSON representation of this document using the given
JsonWriterSettings . |
Collection<BsonValue> |
values() |
asBsonReader, get, getArray, getArray, getBinary, getBinary, getBoolean, getBoolean, getBsonType, getDateTime, getDateTime, getDecimal128, getDecimal128, getDocument, getDocument, getDouble, getDouble, getInt32, getInt32, getInt64, getInt64, getNumber, getNumber, getObjectId, getObjectId, getRegularExpression, getRegularExpression, getString, getString, getTimestamp, getTimestamp, isArray, isBinary, isBoolean, isDateTime, isDecimal128, isDocument, isDouble, isInt32, isInt64, isNull, isNumber, isObjectId, isString, isTimestamp, toBsonDocument, toString
asArray, asBinary, asBoolean, asDateTime, asDBPointer, asDecimal128, asDocument, asDouble, asInt32, asInt64, asJavaScript, asJavaScriptWithScope, asNumber, asObjectId, asRegularExpression, asString, asSymbol, asTimestamp, isArray, isBinary, isBoolean, isDateTime, isDBPointer, isDecimal128, isDocument, isDouble, isInt32, isInt64, isJavaScript, isJavaScriptWithScope, isNull, isNumber, isObjectId, isRegularExpression, isString, isSymbol, isTimestamp
compute, computeIfAbsent, computeIfPresent, entry, forEach, getOrDefault, merge, of, of, of, of, of, of, of, of, of, of, of, ofEntries, putIfAbsent, remove, replace, replace, replaceAll
public RawBsonDocument(byte[] bytes)
bytes
- the bytes representing a BSON document. Note that the byte array is NOT copied, so care must be taken not to modify it
after passing it to this construction, unless of course that is your intention.public RawBsonDocument(byte[] bytes, int offset, int length)
bytes
- the bytes representing a BSON document. Note that the byte array is NOT copied, so care must be taken not to modify it
after passing it to this construction, unless of course that is your intention.offset
- the offset into the byte arraylength
- the length of the subarray to usepublic RawBsonDocument(T document, Codec<T> codec)
T
- the BSON type that the codec encodes/decodesdocument
- the document to transformcodec
- the codec to facilitate the transformationpublic static RawBsonDocument parse(String json)
RawBsonDocument
json
- the JSON stringRawBsonDocument
objectJsonReader
public ByteBuf getByteBuffer()
ByteBuf
that wraps the byte array, with the proper byte order. Any changes made to the returned will be reflected
in the underlying byte array owned by this instance.public <T> T decode(Codec<T> codec)
T
- the BSON type that the codec encodes/decodescodec
- the codec to facilitate the transformationpublic <T> T decode(Decoder<T> decoder)
T
- the BSON type that the codec encodes/decodesdecoder
- the decoder to facilitate the transformationpublic void clear()
public BsonDocument append(String key, BsonValue value)
BsonDocument
append
in class BsonDocument
key
- the keyvalue
- the valuepublic boolean isEmpty()
public int size()
public Collection<BsonValue> values()
public String getFirstKey()
BsonDocument
getFirstKey
in class BsonDocument
public boolean containsKey(Object key)
containsKey
in interface Map<String,BsonValue>
containsKey
in class BsonDocument
public boolean containsValue(Object value)
containsValue
in interface Map<String,BsonValue>
containsValue
in class BsonDocument
public String toJson()
BsonDocument
JsonMode.STRICT
output mode, and otherwise the default
settings of JsonWriterSettings.Builder
.toJson
in class BsonDocument
BsonDocument.toJson(JsonWriterSettings)
,
JsonWriterSettings
public String toJson(JsonWriterSettings settings)
BsonDocument
JsonWriterSettings
.toJson
in class BsonDocument
settings
- the JSON writer settingspublic boolean equals(Object o)
public int hashCode()
public BsonDocument clone()
clone
in class BsonDocument