import {applicationContext} from "../context/ApplicationContext"; import {BEAN_OPTION, COMPONENT_TYPE} from "../@types/types"; export default function TransactionProcessor(){ return function(constructor:U) { let option:BEAN_OPTION = { SCOPE:"singleton", SUBTYPE:"" } option.MODULE_NAME = `${constructor.name}`; const TRANSACTION_PROCESSOR = class extends constructor { constructor(...args: any[]) { let classScope = option.SCOPE const protos = [constructor.prototype, Object.getPrototypeOf(constructor).__proto__]; protos.forEach((proto)=>{ if(!proto) return; Object.keys(proto).forEach((item) => { if(item.indexOf("__") == 0 && item.lastIndexOf("__") == item.length-2){ proto[item].INVOKE(classScope); } }); }); super(); } }; applicationContext.addScanBean(TRANSACTION_PROCESSOR, COMPONENT_TYPE.TRANSACTION_PROCESSOR, option); return TRANSACTION_PROCESSOR; }; }