3434
3535import static java .util .Arrays .asList ;
3636import static org .bson .assertions .Assertions .notNull ;
37+ import static org .bson .codecs .BsonTypeClassMap .DEFAULT_BSON_TYPE_CLASS_MAP ;
3738import static org .bson .codecs .configuration .CodecRegistries .fromProviders ;
3839
3940/**
@@ -48,7 +49,8 @@ public class DocumentCodec implements CollectibleCodec<Document>, OverridableUui
4849 private static final CodecRegistry DEFAULT_REGISTRY = fromProviders (asList (new ValueCodecProvider (),
4950 new BsonValueCodecProvider (),
5051 new DocumentCodecProvider ()));
51- private static final BsonTypeClassMap DEFAULT_BSON_TYPE_CLASS_MAP = new BsonTypeClassMap ();
52+ private static final BsonTypeCodecMap DEFAULT_BSON_TYPE_CODEC_MAP = new BsonTypeCodecMap (DEFAULT_BSON_TYPE_CLASS_MAP , DEFAULT_REGISTRY );
53+ private static final IdGenerator DEFAULT_ID_GENERATOR = new ObjectIdGenerator ();
5254
5355 private final BsonTypeCodecMap bsonTypeCodecMap ;
5456 private final CodecRegistry registry ;
@@ -60,7 +62,7 @@ public class DocumentCodec implements CollectibleCodec<Document>, OverridableUui
6062 * Construct a new instance with a default {@code CodecRegistry}.
6163 */
6264 public DocumentCodec () {
63- this (DEFAULT_REGISTRY );
65+ this (DEFAULT_REGISTRY , DEFAULT_BSON_TYPE_CODEC_MAP , null );
6466 }
6567
6668 /**
@@ -93,8 +95,11 @@ public DocumentCodec(final CodecRegistry registry, final BsonTypeClassMap bsonTy
9395 * @param valueTransformer the value transformer to use as a final step when decoding the value of any field in the document
9496 */
9597 public DocumentCodec (final CodecRegistry registry , final BsonTypeClassMap bsonTypeClassMap , final Transformer valueTransformer ) {
96- this (registry , new BsonTypeCodecMap (notNull ("bsonTypeClassMap" , bsonTypeClassMap ), registry ),
97- new ObjectIdGenerator (), valueTransformer , UuidRepresentation .UNSPECIFIED );
98+ this (registry , new BsonTypeCodecMap (notNull ("bsonTypeClassMap" , bsonTypeClassMap ), registry ), valueTransformer );
99+ }
100+
101+ private DocumentCodec (final CodecRegistry registry , final BsonTypeCodecMap bsonTypeCodecMap , final Transformer valueTransformer ) {
102+ this (registry , bsonTypeCodecMap , DEFAULT_ID_GENERATOR , valueTransformer , UuidRepresentation .UNSPECIFIED );
98103 }
99104
100105 private DocumentCodec (final CodecRegistry registry , final BsonTypeCodecMap bsonTypeCodecMap , final IdGenerator idGenerator ,
0 commit comments