From 88d853bdb786a0af4a1074bd2808222dbe142850 Mon Sep 17 00:00:00 2001 From: crusader Date: Sat, 23 Dec 2017 03:24:42 +0900 Subject: [PATCH] ing --- .../commons/core/reflect/accessible_object.ts | 11 +++---- .../commons/core/reflect/annotated_element.ts | 4 +-- .../commons/core/reflect/annotation.ts | 5 ++++ .../commons/core/reflect/constructor.ts | 30 +++++++++---------- src/ts/@overflow/commons/redux/lpc_reducer.ts | 2 +- 5 files changed, 29 insertions(+), 23 deletions(-) diff --git a/src/ts/@overflow/commons/core/reflect/accessible_object.ts b/src/ts/@overflow/commons/core/reflect/accessible_object.ts index 81c609d..ae7c4f1 100644 --- a/src/ts/@overflow/commons/core/reflect/accessible_object.ts +++ b/src/ts/@overflow/commons/core/reflect/accessible_object.ts @@ -1,5 +1,6 @@ import { ClassType, + TypeUtil, } from '@overflow/commons/core/type'; import { @@ -8,14 +9,14 @@ import { } from '@overflow/commons/core/reflect'; export abstract class AccessibleObject implements AnnotatedElement { - private _annotations: Map; + private _annotations: Map; protected constructor() { this._annotations = new Map(); } public _addAnnotation(annotation: AnnotationType): void { - this._annotations.set((annotation).prototype, annotation); + this._annotations.set(TypeUtil.getClass(annotation), annotation); } public isAnnotationPresent(annotationClass: ClassType): boolean { @@ -23,10 +24,10 @@ export abstract class AccessibleObject implements AnnotatedElement { } public getOwnAnnotation(annotationClass: ClassType): AnnotationType { - return this._annotations.get(annotationClass.prototype); + return this._annotations.get(annotationClass); } - public getOwnAnnotations(): Map { + public getOwnAnnotations(): Map { return this._annotations; } @@ -34,7 +35,7 @@ export abstract class AccessibleObject implements AnnotatedElement { return this.getOwnAnnotation(annotationClass); } - public getAnnotations(): Map { + public getAnnotations(): Map { return this.getOwnAnnotations(); } diff --git a/src/ts/@overflow/commons/core/reflect/annotated_element.ts b/src/ts/@overflow/commons/core/reflect/annotated_element.ts index 7c8cb1d..a5dcc17 100644 --- a/src/ts/@overflow/commons/core/reflect/annotated_element.ts +++ b/src/ts/@overflow/commons/core/reflect/annotated_element.ts @@ -11,7 +11,7 @@ export interface AnnotatedElement { isAnnotationPresent(annotationClass: ClassType): boolean; getOwnAnnotation(annotationClass: ClassType): AnnotationType; - getOwnAnnotations(): Map; + getOwnAnnotations(): Map; getAnnotation(annotationClass: ClassType): AnnotationType; - getAnnotations(): Map; + getAnnotations(): Map; } diff --git a/src/ts/@overflow/commons/core/reflect/annotation.ts b/src/ts/@overflow/commons/core/reflect/annotation.ts index 43b1c87..3f0b0f7 100644 --- a/src/ts/@overflow/commons/core/reflect/annotation.ts +++ b/src/ts/@overflow/commons/core/reflect/annotation.ts @@ -10,3 +10,8 @@ export interface Annotation { descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor | void; parameterDecorator?(target: Object, propertyKey: PropertyKeyType, parameterIndex: number): void; } + +export abstract class Annotation { +} + +export default Annotation; diff --git a/src/ts/@overflow/commons/core/reflect/constructor.ts b/src/ts/@overflow/commons/core/reflect/constructor.ts index 3891078..1aceae2 100644 --- a/src/ts/@overflow/commons/core/reflect/constructor.ts +++ b/src/ts/@overflow/commons/core/reflect/constructor.ts @@ -1,19 +1,19 @@ -import { - PropertyKeyType, -} from '@overflow/commons/core/type'; +// import { +// PropertyKeyType, +// } from '@overflow/commons/core/type'; -import { - Class, - Executable, - } from '@overflow/commons/core/reflect'; +// import { +// Class, +// Executable, +// } from '@overflow/commons/core/reflect'; -export class Constructor extends Executable { +// export class Constructor extends Executable { - public constructor(declaringClazz: Class, parameterTypes: any[]) { - super(declaringClazz, parameterTypes); - } +// public constructor(declaringClazz: Class, parameterTypes: any[]) { +// super(declaringClazz, parameterTypes); +// } - public getName(): PropertyKeyType { - return this.getDeclaringClass().getName(); - } -} +// public getName(): PropertyKeyType { +// return this.getDeclaringClass().getName(); +// } +// } diff --git a/src/ts/@overflow/commons/redux/lpc_reducer.ts b/src/ts/@overflow/commons/redux/lpc_reducer.ts index 627a99c..d21852a 100644 --- a/src/ts/@overflow/commons/redux/lpc_reducer.ts +++ b/src/ts/@overflow/commons/redux/lpc_reducer.ts @@ -59,7 +59,7 @@ export default class LPCReducer { } console.log(`actionMapping-value: ${ama.attributes.value}`); - clazz.getMethods().forEach(method => { + clazz.getOwnMethods().forEach(method => { let restAPIAnnotation: RestAPIAnnotation = method.getOwnAnnotation(RestAPIAnnotation); let rpcAPIAnnotation: RpcAPIAnnotation = method.getOwnAnnotation(RpcAPIAnnotation); if (restAPIAnnotation) {