[JAVA-4461] Add API to apply UuidRepresentation to a CodecRegistry Created: 31/Jan/22  Updated: 28/Oct/23  Resolved: 03/Feb/22

Status: Closed
Project: Java Driver
Component/s: Codecs, Configuration
Affects Version/s: None
Fix Version/s: 4.5.0

Type: New Feature Priority: Minor - P4
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Documentation Changes: Not Needed

 Description   

When a MongoClient is created from MongoClientSettings, the MongoClient applies the uuidRepresentation to the codecRegistry, using an internal API. But there are some use cases, e.g. MongoCollection#withCodecRegistry where an application might find it necessary to apply a different representation to a registry.

The driver should an API to CodecRegistries factory class to allow this, e.g.:

    /**
     * Apply given {@link UuidRepresentation} to the given {@link CodecRegistry}.
     *
     * @param codecRegistry the code registry
     * @param uuidRepresentation the uuid representation
     */
    public static CodecRegistry withUuidRepresentation(final CodecRegistry codecRegistry, 
                   final UuidRepresentation uuidRepresentation)



 Comments   
Comment by Githook User [ 03/Feb/22 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Add CodecRegistries#withUuidRepresentation factory method (#864)

JAVA-4461
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/92f064dfc6dcc6b98297adedeea6bdaf1383113c

Generated at Thu Feb 08 09:02:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.