/** * Creates a new instance initialised with the given codec registry. * * @param codecRegistry the {@code CodecRegistry} to use to look up the codecs for encoding and decoding to/from BSON */ public BsonDocumentCodec(final CodecRegistry codecRegistry) { if (codecRegistry == null) { throw new IllegalArgumentException("Codec registry can not be null"); } this.codecRegistry = codecRegistry; this.bsonTypeCodecMap = new BsonTypeCodecMap(getBsonTypeClassMap(), codecRegistry); }