import { Constructor, FILE_PROPERTY_KEY, NEW_PROPERTY_KEY, PARAMETER_META_KEY, REQUEST_OBJ_PROPERTY_KEY, REQUEST_PROPERTY_KEY, RESPONSE_OBJ_PROPERTY_KEY, SESSION_PROPERTY_KEY, SINGLETON_PROPERTY_KEY } from "../@types/DynamicInject"; import {RequestDiSupplier} from "../injection/RequestDiSupplier"; import {DaoDiSupplier} from "../injection/DaoDiSupplier"; import {SingletonDiSupplier} from "../injection/SingletonDiSupplier"; import {NewDiSupplier} from "../injection/NewDiSupplier"; import {ScopeDecoratorGenerator} from "../injection/ScopeDecoratorFactory"; import {SessionDiSupplier} from "../injection/SessionDiSupplier"; import {FileDiSupplier} from "../injection/FileDiSupplier"; import {RequestObjDiSupplier} from "../injection/RequestObjDiSupplier"; import {ResponseObjDiSupplier} from "../injection/ResponseObjDiSupplier"; export class ScopeParameter { public static REQUEST(...args: (string | Constructor)[]) { return (target: any, paramName: string, index: number) => { new ScopeDecoratorGenerator(PARAMETER_META_KEY, new RequestDiSupplier(), target) .generateMetaData("ScopeParameter.request", REQUEST_PROPERTY_KEY, paramName, index, args) .appendMetadata(); } } public static SINGLETON(...args: (string | Constructor)[]) { return (target: any, paramName: string, index: number) => { new ScopeDecoratorGenerator(PARAMETER_META_KEY, new SingletonDiSupplier(), target) .generateMetaData("ScopeParameter.singleton", SINGLETON_PROPERTY_KEY, paramName, index, args) .appendMetadata(); } } public static NEW(...args: (string | Constructor)[]) { return (target: any, paramName: string, index: number) => { new ScopeDecoratorGenerator(PARAMETER_META_KEY, new NewDiSupplier(), target) .generateMetaData("ScopeParameter.new", NEW_PROPERTY_KEY, paramName, index, args) .appendMetadata(); } } public static SESSION(...args: (string | Constructor)[]) { return (target: any, paramName: string, index: number) => { new ScopeDecoratorGenerator(PARAMETER_META_KEY, new SessionDiSupplier(), target) .generateMetaData("ScopeParameter.SESSION", SESSION_PROPERTY_KEY, paramName, index, args) .appendMetadata(); } } public static DAO(target: any, paramName: string, index: number) { new ScopeDecoratorGenerator(PARAMETER_META_KEY, new DaoDiSupplier(), target) .generateMetaData("ScopeParameter.DAO", REQUEST_PROPERTY_KEY, paramName, index) .appendMetadata(); } public static FILE(...args: (string)[]) { return (target: any, paramName: string, index: number) => { new ScopeDecoratorGenerator(PARAMETER_META_KEY, new FileDiSupplier(), target) .generateMetaData("ScopeParameter.FILE", FILE_PROPERTY_KEY, paramName, index, args) .appendMetadata(); } } } export const Request = function(target: any, paramName: string, index: number) { new ScopeDecoratorGenerator(PARAMETER_META_KEY, new RequestObjDiSupplier(), target) .generateMetaData("ScopeParameter.Request.value", REQUEST_OBJ_PROPERTY_KEY, paramName, index) .appendMetadata(); } export const Response = function(target: any, paramName: string, index: number) { new ScopeDecoratorGenerator(PARAMETER_META_KEY, new ResponseObjDiSupplier(), target) .generateMetaData("ScopeParameter.Response.value", RESPONSE_OBJ_PROPERTY_KEY, paramName, index) .appendMetadata(); }