Package org.bson.conversions
Interface Bson
-
- All Known Implementing Classes:
BsonDocument,BsonDocumentWrapper,Document,JsonObject,RawBsonDocument
public interface BsonAn interface for types that are able to render themselves into aBsonDocument.- Since:
- 3.0
-
-
Field Summary
Fields Modifier and Type Field Description static CodecRegistryDEFAULT_CODEC_REGISTRYThis registry includes the following providers:ValueCodecProviderBsonValueCodecProviderDocumentCodecProviderIterableCodecProviderMapCodecProviderJsr310CodecProviderJsonObjectCodecProviderBsonCodecProvider
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default BsonDocumenttoBsonDocument()Render into a BsonDocument using a document class and codec registry appropriate for the implementation.<TDocument>
BsonDocumenttoBsonDocument(Class<TDocument> documentClass, CodecRegistry codecRegistry)Render into a BsonDocument.
-
-
-
Field Detail
-
DEFAULT_CODEC_REGISTRY
static final CodecRegistry DEFAULT_CODEC_REGISTRY
This registry includes the following providers:ValueCodecProviderBsonValueCodecProviderDocumentCodecProviderIterableCodecProviderMapCodecProviderJsr310CodecProviderJsonObjectCodecProviderBsonCodecProvider
Additional providers may be added in a future release.
- Since:
- 4.2
-
-
Method Detail
-
toBsonDocument
<TDocument> BsonDocument toBsonDocument(Class<TDocument> documentClass, CodecRegistry codecRegistry)
Render into a BsonDocument.- Type Parameters:
TDocument- the type of the document class- Parameters:
documentClass- the document class in scope for the collection. This parameter may be ignored, but it may be used to alter the structure of the returnedBsonDocumentbased on some knowledge of the document class.codecRegistry- the codec registry. This parameter may be ignored, but it may be used to look upCodecinstances for the document class or any other related class.- Returns:
- the BsonDocument
-
toBsonDocument
default BsonDocument toBsonDocument()
Render into a BsonDocument using a document class and codec registry appropriate for the implementation.The default implementation of this method calls
toBsonDocument(Class, CodecRegistry)with theBsonDocumentclass as the first argument andDEFAULT_CODEC_REGISTRYas the second argument.- Returns:
- the BsonDocument
- Since:
- 4.2
-
-