import { ParamHandler, PropertyHandler } from "./Handlers"; /** * Special type that allows to use Function and to known its type as T. */ export declare type ConstructorFunction = { new (...args: any[]): T; }; /** * Service container. */ export declare class Container { private static instances; private static paramHandlers; private static propertyHandlers; private static registeredServices; /** * Registers a new constructor parameter handler. */ static registerParamHandler(paramHandler: ParamHandler): void; /** * Registers a new class property handler. */ static registerPropertyHandler(propertyHandler: PropertyHandler): void; /** * Registers a new service. * * @param name Service name. Optional * @param type Service class * @param params Parameters to be sent to constructor on service initialization */ static registerService(name: string, type: Function, params?: any[]): void; /** * Retrieves the service with the specific name or given type from the service container. * Optionally parameters can be pass in the case if instance is initialized in the container for the first time. */ static get(type: ConstructorFunction, params?: any[]): T; static get(name: string, params?: any[]): T; /** * Sets a value for the given type or service name in the container. */ static set(type: Function, value: any): void; static set(name: string, type: Function, value: any): void; /** * Provides a set of values to be saved in the container. */ static provide(values: { name?: string; type: Function; value: any; }[]): void; private static applyPropertyHandlers(target); private static findInstance(name, type); private static findInstanceByName(name); private static findInstanceByType(type); private static findRegisteredService(name, type); private static findRegisteredServiceByType(type); private static findRegisteredServiceByName(name); private static findParamHandler(type, index); private static initializeParams(type, params); private static isTypeSimple(param); }