import 'reflect-metadata'; import { Scope, ObjectFactory } from './model'; /** * A decorator to tell the container that this class should be handled by the Request [[Scope]]. * * ``` * @ RequestScope * class PersonDAO { * * } * ``` * * Is the same that use: * * ``` * Container.bind(PersonDAO).scope(Scope.Request) * ``` */ export declare function InRequestScope(target: Function): void; /** * A decorator to tell the container that this class should be handled by the Singleton [[Scope]]. * * ``` * @ Singleton * class PersonDAO { * * } * ``` * * Is the same that use: * * ``` * Container.bind(PersonDAO).scope(Scope.Singleton) * ``` */ export declare function Singleton(target: Function): void; /** * A decorator to tell the container that this class should has its instantiation always handled by the Container. * * The decorated class will have its constructor overriden to always delegate its instantiation to the IoC Container. * So, if you write: * * ``` * @ OnlyInstantiableByContainer * class PersonService { * @ Inject * personDAO: PersonDAO; * } * ``` * * You will only be able to create instances of PersonService through the Container. * * ``` * let PersonService = new PersonService(); // will thrown a TypeError exception * ``` */ export declare function OnlyInstantiableByContainer(target: Function): any; /** * A decorator to tell the container that this class should be handled by the provided [[Scope]]. * For example: * * ``` * class MyScope extends Scope { * resolve(iocProvider:Provider, source:Function) { * console.log('created by my custom scope.') * return iocProvider.get(); * } * } * @ Scoped(new MyScope()) * class PersonDAO { * } * ``` * * Is the same that use: * * ``` * Container.bind(PersonDAO).scope(new MyScope()); * ``` * @param scope The scope that will handle instantiations for this class. */ export declare function Scoped(scope: Scope): (target: Function) => void; /** * A decorator to tell the container that this class should instantiated by the given [[ObjectFactory]]. * For example: * * ``` * @ Factory(() => new PersonDAO()) * class PersonDAO { * } * ``` * * Is the same that use: * * ``` * Container.bind(PersonDAO).factory(() => new PersonDAO()); * ``` * @param factory The factory that will handle instantiations for this class. */ export declare function Factory(factory: ObjectFactory): (target: Function) => void; /** * A decorator to request from Container that it resolve the annotated property dependency. * For example: * * ``` * class PersonService { * constructor (@ Inject creationTime: Date) { * this.creationTime = creationTime; * } * @ Inject * personDAO: PersonDAO; * * creationTime: Date; * } * * ``` * * When you call: * * ``` * let personService: PersonService = Container.get(PersonService); * // The properties are all defined, retrieved from the IoC Container * console.log('PersonService.creationTime: ' + personService.creationTime); * console.log('PersonService.personDAO: ' + personService.personDAO); * ``` */ export declare function Inject(...args: Array): any; /** * A decorator to request from Container that it resolve the annotated property dependency * with a constant value. * For example: * * ``` * inteface Config { * dependencyURL: string; * port: number; * } * class PersonService { * @ InjectValue('config') * config: Config; * } * ``` * * When you call: * * ``` * let personService: PersonService = Container.get(PersonService); * // The properties are all defined, retrieved from the IoC Container * console.log('PersonService.config.port: ' + personService.config.port); * console.log('PersonService.config.dependencyURL: ' + personService.config.dependencyURL); * ``` */ export declare function InjectValue(value: string): (...args: any[]) => any;