Table of Contents

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
object
EndpointGenerator
Implements

Constructors

EndpointGenerator(INamingStrategy, BuilderRegistry, TypeNameRegistry?)

Generates the types for a tree of IEndpoints.

public EndpointGenerator(INamingStrategy namingStrategy, BuilderRegistry builders, TypeNameRegistry? typeNames = null)

Parameters

namingStrategy INamingStrategy

Decides what the generated types and members are called.

builders BuilderRegistry

Decides what code is emitted for each kind of endpoint.

typeNames TypeNameRegistry

Keeps 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

IGenerationLog

Naming

Decides what the generated types and members are called.

public INamingStrategy Naming { get; }

Property Value

INamingStrategy

WithInterfaces

Indicates whether an interface is generated alongside each generated endpoint class.

public bool WithInterfaces { get; set; }

Property Value

bool

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

key string
endpoint IEndpoint

Returns

JvmIdentifier

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

key string
endpoint IEndpoint

Returns

(JvmChildEndpoint child, IEnumerable<IJvmType> types)

Generate(EntryEndpoint)

Generates the types for an entire client.

public IEnumerable<IJvmType> Generate(EntryEndpoint endpoint)

Parameters

endpoint EntryEndpoint

Returns

IEnumerable<IJvmType>

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

key string