Table of Contents

Class NameRegistry<T>

Namespace
TypedRest.CodeGeneration.Generation
Assembly
TypedRest.CodeGeneration.dll

Keeps track of the names handed out during a generation run, so that no two generated types end up with the same name.

public class NameRegistry<T>

Type Parameters

T

The type representing a name, e.g. a language-specific type identifier.

Inheritance
object
NameRegistry<T>

Constructors

NameRegistry(Func<T, string>, Func<T, int, T>)

Keeps track of the names handed out during a generation run, so that no two generated types end up with the same name.

public NameRegistry(Func<T, string> getKey, Func<T, int, T> withNumber)

Parameters

getKey Func<T, string>

Maps a name to the string used to detect collisions.

withNumber Func<T, int, T>

Creates a copy of a name with a number appended to it.

Methods

Register(IEnumerable<T>)

Registers the first of the candidates that is still free. Falls back to appending a number to the last candidate if all of them are taken.

public T Register(IEnumerable<T> candidates)

Parameters

candidates IEnumerable<T>

Returns

T

Register(T)

Registers a name, appending a number if it is already taken.

public T Register(T candidate)

Parameters

candidate T

Returns

T