[go: up one dir, main page]

Rework BsonContext

BsonContext started as a factory for BSON objects, but it's starting to become a god class.

  • Modify :bson, split it into:
    • ObjectIdGenerator (already separate)
    • BsonFactory (gets the current contents of BsonContext)

Instead, BsonContext becomes a regular class that is part of :dsl:

class BsonContext(
    val factory: BsonFactory,
    val objectId: ObjectIdGenerator = ObjectIdGenerator.Default(),
    val nameStrategy: PropertyNameStrategy = PropertyNameStrategy.Default,
)

Finally, move PropertyNameStrategy to :dsl.