Class EndpointGenerator
- Namespace
- TypedRest.CodeGeneration.Jvm.Endpoints
- Assembly
- TypedRest.CodeGeneration.Jvm.dll
Generates the types for a tree of IEndpoints.
public class EndpointGenerator : IEndpointGenerator
- Inheritance
-
objectEndpointGenerator
- Implements
Constructors
EndpointGenerator(INamingStrategy, BuilderRegistry, TypeNameRegistry?)
Generates the types for a tree of IEndpoints.
public EndpointGenerator(INamingStrategy namingStrategy, BuilderRegistry builders, TypeNameRegistry? typeNames = null)
Parameters
namingStrategyINamingStrategyDecides what the generated types and members are called.
buildersBuilderRegistryDecides what code is emitted for each kind of endpoint.
typeNamesTypeNameRegistryKeeps the generated names from colliding. Share this with a DTO generator writing to the same package.
Properties
Log
Collects messages about aspects of the document the target language cannot express.
public IGenerationLog Log { get; set; }
Property Value
Naming
Decides what the generated types and members are called.
public INamingStrategy Naming { get; }
Property Value
WithInterfaces
Indicates whether an interface is generated alongside each generated endpoint class.
public bool WithInterfaces { get; set; }
Property Value
Remarks
When on, generated classes take the Impl suffix and the interface keeps the plain name. When off,
the class keeps the plain name and no interface is generated.
Methods
EndpointType(string, IEndpoint)
Reserves a unique name for a generated endpoint class.
public JvmIdentifier EndpointType(string key, IEndpoint endpoint)
Parameters
Returns
Generate(string, IEndpoint)
Generates the member exposing an endpoint on its parent, plus any types needed for it.
public (JvmChildEndpoint child, IEnumerable<IJvmType> types) Generate(string key, IEndpoint endpoint)
Parameters
Returns
Generate(EntryEndpoint)
Generates the types for an entire client.
public IEnumerable<IJvmType> Generate(EntryEndpoint endpoint)
Parameters
endpointEntryEndpoint
Returns
PopParent()
Records that generation has left the children of the most recently pushed endpoint.
public void PopParent()
PushParent(string)
Records that generation has descended into the children of the endpoint with this key.
public void PushParent(string key)
Parameters
keystring