Class BuilderRegistry<TBuilder>
- Namespace
- TypedRest.CodeGeneration.Generation
- Assembly
- TypedRest.CodeGeneration.dll
Maps each Kind to the builder emitting code for it, holding at most one builder per kind.
public class BuilderRegistry<TBuilder> where TBuilder : notnull
Type Parameters
TBuilderThe target language's builder interface.
- Inheritance
-
objectBuilderRegistry<TBuilder>
- Derived
Methods
For(IEndpoint)
Returns the builder suitable for the kind of endpoint.
public TBuilder For(IEndpoint endpoint)
Parameters
endpointIEndpoint
Returns
- TBuilder
Exceptions
- KeyNotFoundException
No builder matching the endpoint's kind found.
Register<TEndpoint>(TBuilder)
Registers builder for the kind of TEndpoint.
protected void Register<TEndpoint>(TBuilder builder) where TEndpoint : IEndpoint, new()
Parameters
builderTBuilder
Type Parameters
TEndpointThe type of IEndpoint the builder generates code for.
Remarks
Deliberately not called Add, so that a derived fluent Add taking a more specific
builder type cannot accidentally bind to itself.
Exceptions
- ArgumentException
A builder is already registered for that kind.