RegistryBuilder
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
RegistryBuilder.type
Members list
Value members
Concrete methods
Create builder from base registry with custom configuration
Create builder from base registry with custom configuration
Attributes
Create builder from base registry with default configuration
Create builder from base registry with default configuration
Attributes
Extensions
Extensions
Build the final CodecRegistry.
Build the final CodecRegistry.
This is when the actual registry is constructed from all registered codecs and providers. Call this method only once at the end of your configuration chain.
Attributes
Configure with a function - functional approach for flexible configuration.
Configure with a function - functional approach for flexible configuration.
This is the most flexible configuration method, allowing you to transform the configuration using any logic you need.
Value parameters
- f
-
Function to transform the current configuration
Attributes
- Example
-
// Simple configuration builder.configure(_.copy(noneHandling = NoneHandling.Ignore)) // Using helper methods on CodecConfig builder.configure(_.withIgnoreNone.withDiscriminator("_type")) // Conditional configuration builder.configure { config => if (useEncoding) config.withEncodeNone else config.withIgnoreNone }
Set the discriminator field name for sealed hierarchies.
Set the discriminator field name for sealed hierarchies.
Value parameters
- field
-
The field name to use for type discriminators (default: "_t")
Attributes
Switch policy: encode None as BSON null.
Switch policy: encode None as BSON null.
Attributes
Switch policy: omit None fields entirely from BSON documents.
Switch policy: omit None fields entirely from BSON documents.
Attributes
Register a type with automatic codec derivation.
Register a type with automatic codec derivation.
Relies on Scala 3 inline macros to auto-generate the BSON codec. Works for nested case classes and sealed hierarchies.
Performance note: Intermediate registries are cached to avoid rebuilding the same registry multiple times during chained register calls.
Type parameters
- T
-
The type to register (must be a case class)
Attributes
Batch register multiple types using tuple syntax.
Batch register multiple types using tuple syntax.
This is more efficient than calling register multiple times separately as it minimizes intermediate registry builds.
Type parameters
- T
-
A tuple of types to register
Attributes
- Example
-
builder.registerAll[(Person, Address, Department)]
Add a single explicit codec.
Add a single explicit codec.
Useful for value classes or third-party types where automatic derivation is not possible.
Value parameters
- codec
-
The codec to add
Attributes
Add multiple codecs at once.
Add multiple codecs at once.
Value parameters
- codecs
-
Variable number of codecs to add
Attributes
Set the codec configuration directly.
Set the codec configuration directly.
Value parameters
- newConfig
-
The codec configuration to use
Attributes
Create a new builder with custom configuration
Create a new builder with custom configuration
Attributes
Create a new builder from this registry
Create a new builder from this registry