Class ProductKindBuilder
Builds and registers immutable logical product kinds.
public sealed class ProductKindBuilder
- Inheritance
-
ProductKindBuilder
- Inherited Members
- Extension Methods
Constructors
ProductKindBuilder(string)
Creates a builder for a stable, namespaced logical product kind.
public ProductKindBuilder(string id)
Parameters
idstringA stable identifier in
<namespace>:<name>form, such asexamplemod:mdma.
Exceptions
- ArgumentNullException
Thrown when
idis null.- ArgumentException
Thrown when
idis empty or does not use the supported namespaced format.
Methods
Build()
Builds and registers the configured product kind.
public ProductKind Build()
Returns
- ProductKind
The newly registered product kind, or the existing instance when an equivalent registration already exists.
Remarks
Repeated calls return the existing instance while the builder configuration remains equivalent. Changing compatibility metadata after the first successful call creates a conflicting registration.
Exceptions
- InvalidOperationException
Thrown when the identifier is already registered with different compatibility metadata.
WithCompatibilityDrugType(DrugType)
Sets optional compatibility metadata for systems that still reason about vanilla drug types.
public ProductKindBuilder WithCompatibilityDrugType(DrugType drugType)
Parameters
drugTypeDrugTypeThe API-safe vanilla drug type that best represents this product kind.
Returns
- ProductKindBuilder
This builder for method chaining.
Exceptions
- ArgumentOutOfRangeException
Thrown when
drugTypeis not a defined DrugType value.