UNPKG

@kephas/reflection

Version:

Provides reflection capabilities, like TypeInfoRegistry, ITypeInfo, and IProperty.

58 lines (57 loc) 1.71 kB
import { ITypeInfo, ITypeInfoRegistry } from './interfaces'; /** * Provides centralized access to the application's type system. * * @export * @class TypeInfoRegistry */ export declare class TypeInfoRegistry implements ITypeInfoRegistry { /** * Gets the registerd types. * * @type {ITypeInfo[]} * @memberof TypeInfoRegistry */ readonly types: ITypeInfo[]; /** * Gets the singleton instance of the type registry. * * @static * @type {TypeInfoRegistry} * @memberof TypeInfoRegistry */ static get Instance(): ITypeInfoRegistry; private static _instance; private _typesByFullName; private _typesByName; /** * Creates an instance of TypeInfoRegistry. * @memberof TypeInfoRegistry */ constructor(); /** * Gets the type in the registry by its name. * * @param {string | Function} typeRef The full name of the type or the runtime type. * @param {boolean} [throwOnNotFound=true] True to throw if the type cannot be found. * @returns {TypeInfo} * @memberof TypeInfoRegistry */ getType(typeRef: string | Function, throwOnNotFound?: boolean): ITypeInfo | undefined; /** * Registers the provided types. * * @param {ITypeInfo[]} types The types to register. * @returns {this} This registry. * @memberof TypeInfoRegistry */ register(...types: ITypeInfo[]): this; /** * Initializes the registry. * * @protected * @param {TypeInfoRegistry} registry * @memberof TypeInfoRegistry */ protected initialize(registry: TypeInfoRegistry): void; }