ing
This commit is contained in:
parent
1461c2a76d
commit
795b91d4f8
|
@ -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}`);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user