From 795b91d4f8957f48751bc8d136c0dfb00a9f5923 Mon Sep 17 00:00:00 2001 From: crusader Date: Sun, 24 Dec 2017 11:58:22 +0900 Subject: [PATCH] ing --- src/ts/@overflow/commons/redux/lpc_reducer.ts | 51 ++++++++++--------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/src/ts/@overflow/commons/redux/lpc_reducer.ts b/src/ts/@overflow/commons/redux/lpc_reducer.ts index b8d5cc6..41be2c4 100644 --- a/src/ts/@overflow/commons/redux/lpc_reducer.ts +++ b/src/ts/@overflow/commons/redux/lpc_reducer.ts @@ -46,38 +46,39 @@ export default class LPCReducer { */ public registerReducers(reducerTypes: ClassType[]): void { for (let reducerType of reducerTypes) { - let clazz: Class = Class.forClass(reducerType); - let ra: ReducerAnnotation = clazz.getOwnAnnotation(ReducerAnnotation); - if (undefined === ra) { - continue; - } - console.log(`name: ${ra.attributes.name}`); - let ama: ActionMappingAnnotation = clazz.getOwnAnnotation(ActionMappingAnnotation); - if (undefined === ama) { - continue; - } - console.log(`actionMapping-value: ${ama.attributes.value}`); - - clazz.getOwnMethods().forEach(method => { - let restAPIAnnotation: RestAPIAnnotation = method.getOwnAnnotation(RestAPIAnnotation); - let rpcAPIAnnotation: RpcAPIAnnotation = method.getOwnAnnotation(RpcAPIAnnotation); - if (restAPIAnnotation) { - console.log(`restAPI: ${restAPIAnnotation.attributes.entryPath}`); - } - if (rpcAPIAnnotation) { - console.log(`restAPI: ${rpcAPIAnnotation.attributes.method}`); - } - }); - + this.registerReducer(reducerType); } - } /** * registerReducer */ public registerReducer(reducerType: ClassType): void { - console.log(``); + let clazz: Class = Class.forClass(reducerType); + + let ra: ReducerAnnotation = clazz.getOwnAnnotation(ReducerAnnotation); + if (undefined === ra) { + console.warn(`Class is not Reducer type. add @Reducer annotation to class[${reducerType.name}]`); + return; + } + + let reducerMapping: string = null; + let ama: ActionMappingAnnotation = clazz.getOwnAnnotation(ActionMappingAnnotation); + if (undefined !== ama) { + reducerMapping = ama.attributes.value; + } + console.log(`actionMapping-value: ${ama.attributes.value}`); + + clazz.getOwnMethods().forEach(method => { + let restAPIAnnotation: RestAPIAnnotation = method.getOwnAnnotation(RestAPIAnnotation); + let rpcAPIAnnotation: RpcAPIAnnotation = method.getOwnAnnotation(RpcAPIAnnotation); + if (restAPIAnnotation) { + console.log(`restAPI: ${restAPIAnnotation.attributes.entryPath}`); + } + if (rpcAPIAnnotation) { + console.log(`restAPI: ${rpcAPIAnnotation.attributes.method}`); + } + }); } }