import { ClassType, Type } from "../../type"; import { Injector } from "../Injector"; import { ProviderValueFactory } from "./ProviderValueFactory"; import { InjectionToken } from "./InjectionToken"; /** * Injector data mapping instance. */ export declare class InjectionMapping { readonly type: ClassType | InjectionToken; readonly injector: Injector; private readonly masterSealKey; private _sealed; private _destroyed; private provider; private sealKey; private defaultProviderSet; /** * Create new instance of injector mapping * @param type Constructable or abstract class type by which value will be mapped * @param injector Injector instance * @param masterSealKey Master seal key */ constructor(type: ClassType | InjectionToken, injector: Injector, masterSealKey: Object); /** * Whether injection is sealed */ get sealed(): boolean; /** * Whether injection is destroyed */ get destroyed(): boolean; get isSingletonProvider(): boolean; /** * Makes the mapping return a lazily constructed singleton instance of the mapped type, for * each consecutive request. * @returns {InjectionMapping} The InjectionMapping the method is invoked on */ asSingleton(): Pick; /** * Makes the mapping return a lazily constructed singleton instance of the mapped type for * each consecutive request. * @param type Type that should be used as source of singleton instance * @returns {InjectionMapping} The InjectionMapping the method is invoked on */ toSingleton(type: Type): Pick; /** * Makes the mapping return a newly created instance of the given type for * each consecutive request. * @param type Type that should be used as new injected value is spawned * @returns {InjectionMapping} The InjectionMapping the method is invoked on */ toType(type: Type): Pick; /** * Makes the mapping return the given value for each consecutive request. * @param value Hard coded value to be returned for each request */ toValue(value: T): Pick; /** * Makes the mapping return existing mapping from current injector or any of its parents upon each request * @param type Existing mapping type to use as for a return value. */ toExisting(type: ClassType): Pick; /** * Map to factory function used to initialize mapped value * @param factory */ toFactory(factory: ProviderValueFactory): Pick; /** * Seal mapping and don't allow any changes to it whist Injector that hosts this mapping is destroyed or mapping * is unsealed. * @returns {Object} Seal key to be used for unseal operation. */ seal(): Object; /** * Unseal mapping. * @param key Seal key which was returned as a return value for seal() operation. * @returns {InjectionMapping} The InjectionMapping the method is invoked on */ unseal(key: Object): this; /** * Retrieve provided value of current injector mapping. */ getInjectedValue(): T; /** * Destroy injection provider and invoke clearCommandMap of values provided if current value type supports that. */ destroy(): void; /** * Check if requested type can be satisfied by current mapping by checking if type is within inheritance chain * of injection mapping * @param type */ satisfiesType(type: ClassType): boolean; private setProvider; }