# Registry Class

Module
import { Registry } from "@tsed/core"
Source/packages/core/src/class/Registry.ts

# Overview

class Registry<T, O> extends Map<RegistryKey, T> {
    constructor(_class: Type<T>, options?: RegistryHook<T>);
    get(key: RegistryKey): T | undefined;
    createIfNotExists(key: RegistryKey): T;
    has(key: RegistryKey): boolean;
    set(key: RegistryKey, metadata: T): this;
    merge(target: RegistryKey, options: Partial<O>): void;
    delete(key: RegistryKey): boolean;
}

# Members

get(key: RegistryKey): T | undefined
Param Type Description
key RegistryKey Required. The key of the element to return from the Map object.

The get() method returns a specified element from a Map object.


createIfNotExists(key: RegistryKey): T

has(key: RegistryKey): boolean

The has() method returns a boolean indicating whether an element with the specified key exists or not.


set(key: RegistryKey, metadata: T): this
Param Type Description
key RegistryKey Required. The key of the element to add to the Map object. metadata

The set() method adds or updates an element with a specified key and value to a Map object.


merge(target: RegistryKey, options: Partial<O>): void

delete(key: RegistryKey): boolean
Param Type Description
key RegistryKey Required. The key of the element to remove from the Map object.

The delete() method removes the specified element from a Map object.