T - the type of the document that is wrappedpublic final class BsonDocumentWrapper<T> extends BsonDocument
BsonDocument that begins its life as a document of any type and an Encoder for that document, which lets an instance of
any class with an Encoder be treated as a BsonDocument. If any methods are called which required access to the individual elements of the
document, then, on demand, the document will be unwrapped into a BsonDocument using a BsonDocumentWriter and the Encoder.
But if all that is done with this document is to encode it, then the Encoder will be used to do that.BsonDocumentWriter,
Serialized Form| Constructor and Description |
|---|
BsonDocumentWrapper(T wrappedDocument,
Encoder<T> encoder)
Construct a new instance with the given document and encoder for the document.
|
| Modifier and Type | Method and Description |
|---|---|
static BsonDocument |
asBsonDocument(java.lang.Object document,
CodecRegistry codecRegistry)
A helper to convert an document of type Object to a BsonDocument
|
void |
clear() |
BsonDocument |
clone() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
java.util.Set<java.util.Map.Entry<java.lang.String,BsonValue>> |
entrySet() |
boolean |
equals(java.lang.Object o) |
BsonValue |
get(java.lang.Object key) |
Encoder<T> |
getEncoder()
Get the encoder to use for the wrapped document.
|
T |
getWrappedDocument()
Get the wrapped document.
|
int |
hashCode() |
boolean |
isEmpty() |
boolean |
isUnwrapped()
Determine whether the document has been unwrapped already.
|
java.util.Set<java.lang.String> |
keySet() |
BsonValue |
put(java.lang.String key,
BsonValue value) |
void |
putAll(java.util.Map<? extends java.lang.String,? extends BsonValue> m) |
BsonValue |
remove(java.lang.Object key) |
int |
size() |
java.lang.String |
toString() |
java.util.Collection<BsonValue> |
values() |
append, asBsonReader, get, getArray, getArray, getBinary, getBinary, getBoolean, getBoolean, getBsonType, getDateTime, getDateTime, getDecimal128, getDecimal128, getDocument, getDocument, getDouble, getDouble, getFirstKey, 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, parse, toBsonDocument, toJson, toJsonasArray, 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, isTimestamppublic static BsonDocument asBsonDocument(java.lang.Object document, CodecRegistry codecRegistry)
If not already a BsonDocument it looks up the documents' class in the codecRegistry and wraps it into a BsonDocumentWrapper
document - the document to convertcodecRegistry - the codecRegistry that can be used in the conversion of the Objectpublic T getWrappedDocument()
public Encoder<T> getEncoder()
public boolean isUnwrapped()
public int size()
size in interface java.util.Map<java.lang.String,BsonValue>size in class BsonDocumentpublic boolean isEmpty()
isEmpty in interface java.util.Map<java.lang.String,BsonValue>isEmpty in class BsonDocumentpublic boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Map<java.lang.String,BsonValue>containsKey in class BsonDocumentpublic boolean containsValue(java.lang.Object value)
containsValue in interface java.util.Map<java.lang.String,BsonValue>containsValue in class BsonDocumentpublic BsonValue get(java.lang.Object key)
get in interface java.util.Map<java.lang.String,BsonValue>get in class BsonDocumentpublic BsonValue put(java.lang.String key, BsonValue value)
put in interface java.util.Map<java.lang.String,BsonValue>put in class BsonDocumentpublic BsonValue remove(java.lang.Object key)
remove in interface java.util.Map<java.lang.String,BsonValue>remove in class BsonDocumentpublic void putAll(java.util.Map<? extends java.lang.String,? extends BsonValue> m)
putAll in interface java.util.Map<java.lang.String,BsonValue>putAll in class BsonDocumentpublic void clear()
clear in interface java.util.Map<java.lang.String,BsonValue>clear in class BsonDocumentpublic java.util.Set<java.lang.String> keySet()
keySet in interface java.util.Map<java.lang.String,BsonValue>keySet in class BsonDocumentpublic java.util.Collection<BsonValue> values()
values in interface java.util.Map<java.lang.String,BsonValue>values in class BsonDocumentpublic java.util.Set<java.util.Map.Entry<java.lang.String,BsonValue>> entrySet()
entrySet in interface java.util.Map<java.lang.String,BsonValue>entrySet in class BsonDocumentpublic boolean equals(java.lang.Object o)
equals in interface java.util.Map<java.lang.String,BsonValue>equals in class BsonDocumentpublic int hashCode()
hashCode in interface java.util.Map<java.lang.String,BsonValue>hashCode in class BsonDocumentpublic java.lang.String toString()
toString in class BsonDocumentpublic BsonDocument clone()
clone in class BsonDocumentCopyright © 2010 - 2023 Adobe. All Rights Reserved