diff --git a/src/ts/@overflow/commons/core/reflect/accessible_object.ts b/src/ts/@overflow/commons/core/reflect/accessible_object.ts new file mode 100644 index 0000000..81c609d --- /dev/null +++ b/src/ts/@overflow/commons/core/reflect/accessible_object.ts @@ -0,0 +1,41 @@ +import { + ClassType, +} from '@overflow/commons/core/type'; + +import { + AnnotatedElement, + Annotation, + } from '@overflow/commons/core/reflect'; + +export abstract class AccessibleObject implements AnnotatedElement { + private _annotations: Map; + + protected constructor() { + this._annotations = new Map(); + } + + public _addAnnotation(annotation: AnnotationType): void { + this._annotations.set((annotation).prototype, annotation); + } + + public isAnnotationPresent(annotationClass: ClassType): boolean { + return null !== this.getAnnotation(annotationClass); + } + + public getOwnAnnotation(annotationClass: ClassType): AnnotationType { + return this._annotations.get(annotationClass.prototype); + } + + public getOwnAnnotations(): Map { + return this._annotations; + } + + public getAnnotation(annotationClass: ClassType): AnnotationType { + return this.getOwnAnnotation(annotationClass); + } + + 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 new file mode 100644 index 0000000..7c8cb1d --- /dev/null +++ b/src/ts/@overflow/commons/core/reflect/annotated_element.ts @@ -0,0 +1,17 @@ +import { + ClassType, +} from '@overflow/commons/core/type'; + +import { + Annotation, +} from '@overflow/commons/core/reflect'; + +export interface AnnotatedElement { + _addAnnotation(annotation: AnnotationType): void; + + isAnnotationPresent(annotationClass: ClassType): boolean; + getOwnAnnotation(annotationClass: ClassType): AnnotationType; + getOwnAnnotations(): Map; + getAnnotation(annotationClass: ClassType): AnnotationType; + getAnnotations(): Map; +} diff --git a/src/ts/@overflow/commons/decorator/annotation/annotation.ts b/src/ts/@overflow/commons/core/reflect/annotation.ts similarity index 84% rename from src/ts/@overflow/commons/decorator/annotation/annotation.ts rename to src/ts/@overflow/commons/core/reflect/annotation.ts index 956f9a1..43b1c87 100644 --- a/src/ts/@overflow/commons/decorator/annotation/annotation.ts +++ b/src/ts/@overflow/commons/core/reflect/annotation.ts @@ -4,15 +4,9 @@ import { } from '@overflow/commons/core/type'; export interface Annotation { - metadataKey(): MetadataKeyType; classDecorator?(target: TFunction): TFunction | void; propertyDecorator?(target: Object, propertyKey: PropertyKeyType): void; methodDecorator?(target: Object, propertyKey: PropertyKeyType, 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/class.ts b/src/ts/@overflow/commons/core/reflect/class.ts new file mode 100644 index 0000000..cc32232 --- /dev/null +++ b/src/ts/@overflow/commons/core/reflect/class.ts @@ -0,0 +1,112 @@ +import { + ClassType, + PropertyKeyType, + Metadata, +} from '@overflow/commons/core/type'; + +import { + AccessibleObject, + Field, + Method, +} from '@overflow/commons/core/reflect'; + +export class Class extends AccessibleObject { + private _clazzType: ClassType; + private _fields: Map; + private _methods: Map; + + /** + * forClass + */ + public static forClass(clazzType: ClassType): Class { + return Metadata.get(LOAFER_CLASS, clazzType); + } + + /** + * _defineClass + */ + public static _defineClass(clazzType: ClassType): Class { + let clazz: Class = Metadata.get(LOAFER_CLASS, clazzType); + if (undefined === clazz) { + clazz = new Class(clazzType); + Metadata.set(LOAFER_CLASS, clazz, clazzType); + } + + return clazz; + } + + private constructor(clazzType: ClassType) { + super(); + this._clazzType = clazzType; + this._fields = new Map(); + this._methods = new Map(); + } + + /** + * _defineField + */ + public _defineField(propertyKey: PropertyKeyType, propertyType: any): Field { + let field: Field = this._fields.get(propertyKey); + if (undefined === field) { + field = new Field(this, propertyKey, propertyType); + this._fields.set(propertyKey, field); + } + return field; + } + + /** + * _defineMethod + */ + public _defineMethod(propertyKey: PropertyKeyType, parameterTypes: any[], returnType: any): Method { + let method: Method = this._methods.get(propertyKey); + if (undefined === method) { + method = new Method(this, propertyKey, parameterTypes, returnType); + this._methods.set(propertyKey, method); + } + return method; + } + + + public getOwnField(propertyKey: PropertyKeyType): Field { + return this._fields.get(propertyKey); + } + + public getOwnFields(): Map { + return this._fields; + } + + public getField(propertyKey: PropertyKeyType): Field { + return null; + } + + public getFields(): Field[] { + return null; + } + + public getOwnMethod(propertyKey: PropertyKeyType): Method { + return this._methods.get(propertyKey); + } + + public getOwnMethods(): Map { + return this._methods; + } + + public getMethod(propertyKey: PropertyKeyType): Method { + return null; + } + + public getMethods(): Method[] { + return null; + } + + public getName(): string { + return null; + } +} + +/** + * Metadata key + * @private + * @type {string} + */ +const LOAFER_CLASS = Symbol('loafer:class'); diff --git a/src/ts/@overflow/commons/core/reflect/constructor.ts b/src/ts/@overflow/commons/core/reflect/constructor.ts new file mode 100644 index 0000000..3891078 --- /dev/null +++ b/src/ts/@overflow/commons/core/reflect/constructor.ts @@ -0,0 +1,19 @@ +import { + PropertyKeyType, +} from '@overflow/commons/core/type'; + +import { + Class, + Executable, + } from '@overflow/commons/core/reflect'; + +export class Constructor extends Executable { + + public constructor(declaringClazz: Class, parameterTypes: any[]) { + super(declaringClazz, parameterTypes); + } + + public getName(): PropertyKeyType { + return this.getDeclaringClass().getName(); + } +} diff --git a/src/ts/@overflow/commons/core/reflect/executable.ts b/src/ts/@overflow/commons/core/reflect/executable.ts new file mode 100644 index 0000000..74c582f --- /dev/null +++ b/src/ts/@overflow/commons/core/reflect/executable.ts @@ -0,0 +1,64 @@ +import { + PropertyKeyType, +} from '@overflow/commons/core/type'; + +import { + AccessibleObject, + Class, + Member, + Parameter, + } from '@overflow/commons/core/reflect'; + +export abstract class Executable extends AccessibleObject implements Member { + private _clazz: Class; + private _parameters: Parameter[]; + + protected constructor(declaringClazz: Class, parameterTypes: any[]) { + super(); + + this._clazz = declaringClazz; + + if (null === parameterTypes) { + return; + } + this._parameters = []; + for (let i = 0; i < parameterTypes.length; i++) { + const parameterType = parameterTypes[i]; + let parameter: Parameter = new Parameter(this, parameterType, i); + this._parameters.push(parameter); + } + } + + public getDeclaringClass(): Class { + return this._clazz; + } + + public abstract getName(): PropertyKeyType; + /** + * getParameterCount + */ + public getParameterCount(): number { + if (null === this._parameters) { + return 0; + } + return this._parameters.length; + } + /** + * getParameters + */ + public getParameters(): Parameter[] { + return this._parameters; + } + /** + * getParameter + */ + public getParameter(index: number): Parameter { + if (null === this._parameters) { + return null; + } + if (0 > index || this._parameters.length <= index) { + return null; + } + return this._parameters[index]; + } +} diff --git a/src/ts/@overflow/commons/core/reflect/field.ts b/src/ts/@overflow/commons/core/reflect/field.ts new file mode 100644 index 0000000..af6687a --- /dev/null +++ b/src/ts/@overflow/commons/core/reflect/field.ts @@ -0,0 +1,35 @@ +import { + PropertyKeyType, +} from '@overflow/commons/core/type'; + +import { + AccessibleObject, + Class, + Member, + } from '@overflow/commons/core/reflect'; + +export class Field extends AccessibleObject implements Member { + private _clazz: Class; + private _name: PropertyKeyType; + private _type: any; + + public constructor(declaringClazz: Class, name: PropertyKeyType, fieldType: any) { + super(); + this._clazz = declaringClazz; + this._name = name; + this._type = fieldType; + } + + public getDeclaringClass(): Class { + return this._clazz; + } + + public getName(): PropertyKeyType { + return this._name; + } + + public getType(): any { + return this._type; + } + +} diff --git a/src/ts/@overflow/commons/core/reflect/index.ts b/src/ts/@overflow/commons/core/reflect/index.ts new file mode 100644 index 0000000..550ae60 --- /dev/null +++ b/src/ts/@overflow/commons/core/reflect/index.ts @@ -0,0 +1,10 @@ +export * from './accessible_object'; +export * from './annotated_element'; +export * from './annotation'; +export * from './class'; +export * from './constructor'; +export * from './executable'; +export * from './field'; +export * from './member'; +export * from './method'; +export * from './parameter'; diff --git a/src/ts/@overflow/commons/core/reflect/member.ts b/src/ts/@overflow/commons/core/reflect/member.ts new file mode 100644 index 0000000..055a61a --- /dev/null +++ b/src/ts/@overflow/commons/core/reflect/member.ts @@ -0,0 +1,12 @@ +import { + Class, +} from '@overflow/commons/core/reflect'; + +import { + PropertyKeyType, +} from '@overflow/commons/core/type'; + +export interface Member { + getDeclaringClass(): Class; + getName(): PropertyKeyType; +} diff --git a/src/ts/@overflow/commons/core/reflect/method.ts b/src/ts/@overflow/commons/core/reflect/method.ts new file mode 100644 index 0000000..c1ca432 --- /dev/null +++ b/src/ts/@overflow/commons/core/reflect/method.ts @@ -0,0 +1,27 @@ +import { + PropertyKeyType, +} from '@overflow/commons/core/type'; + +import { + Class, + Executable, + } from '@overflow/commons/core/reflect'; + +export class Method extends Executable { + private _name: PropertyKeyType; + private _returnType: any; + + public constructor(declaringClazz: Class, name: PropertyKeyType, parameterTypes: any[], returnType: any) { + super(declaringClazz, parameterTypes); + this._name = name; + this._returnType = returnType; + } + + public getName(): PropertyKeyType { + return this._name; + } + + public getReturnType(): any { + return this._returnType; + } +} diff --git a/src/ts/@overflow/commons/core/reflect/parameter.ts b/src/ts/@overflow/commons/core/reflect/parameter.ts new file mode 100644 index 0000000..6d8d02d --- /dev/null +++ b/src/ts/@overflow/commons/core/reflect/parameter.ts @@ -0,0 +1,29 @@ +import { + AccessibleObject, + Executable, +} from '@overflow/commons/core/reflect'; + +export class Parameter extends AccessibleObject { + private _executable: Executable; + private _type: any; + private _index: number; + + public constructor(executable: Executable, parameterType: any, index: number) { + super(); + this._executable = executable; + this._type = parameterType; + this._index = index; + } + + public getDeclaringExecutable(): Executable { + return this._executable; + } + + public getType(): any { + return this._type; + } + + public getIndex(): number { + return this._index; + } +} diff --git a/src/ts/@overflow/commons/core/type/type.ts b/src/ts/@overflow/commons/core/type/type.ts index d26e3e0..2260719 100644 --- a/src/ts/@overflow/commons/core/type/type.ts +++ b/src/ts/@overflow/commons/core/type/type.ts @@ -2,8 +2,8 @@ export type IdentityType = T | symbol; export type PropertyKeyType = IdentityType; export type MetadataKeyType = IdentityType; -export const ConstructorType = Function; -export interface ConstructorType extends Function { +export const ClassType = Function; +export interface ClassType extends Function { new (...args: any[]): T; } diff --git a/src/ts/@overflow/commons/core/type/util.ts b/src/ts/@overflow/commons/core/type/util.ts index 4401412..9020cd9 100644 --- a/src/ts/@overflow/commons/core/type/util.ts +++ b/src/ts/@overflow/commons/core/type/util.ts @@ -1,5 +1,5 @@ import { - ConstructorType, + ClassType, DecoratorType, DecoratorParametersType, PrimitiveType, @@ -12,7 +12,7 @@ export class TypeUtil { * Get the provide constructor. * @param targetClass */ - public static getContructor(targetClass: any): ConstructorType { + public static getContructor(targetClass: any): ClassType { return typeof targetClass === 'function' ? targetClass : targetClass.constructor; @@ -23,7 +23,7 @@ export class TypeUtil { * @param target * @returns {*} */ - public static getClass(target: any): any { + public static getClass(target: any): ClassType { return target.prototype ? target : target.constructor; } diff --git a/src/ts/@overflow/commons/decorator/annotation/index.ts b/src/ts/@overflow/commons/decorator/annotation/index.ts deleted file mode 100644 index acd091e..0000000 --- a/src/ts/@overflow/commons/decorator/annotation/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './annotation'; diff --git a/src/ts/@overflow/commons/decorator/decorator.ts b/src/ts/@overflow/commons/decorator/decorator.ts index 3e2ad7b..d436f42 100644 --- a/src/ts/@overflow/commons/decorator/decorator.ts +++ b/src/ts/@overflow/commons/decorator/decorator.ts @@ -1,5 +1,13 @@ import { - ConstructorType, + Annotation, + Class, + Field, + Method, + Parameter, +} from '@overflow/commons/core/reflect'; + +import { + ClassType, DecoratorType, MetadataKeyType, Metadata, @@ -7,12 +15,10 @@ import { } from '@overflow/commons/core/type'; import * as Constants from './constants'; -import { - Annotation, -} from './annotation'; + export class Decorator { - public static create = (AnnotationClass: ConstructorType) => { + public static create = (AnnotationClass: ClassType) => { return (...handlerArgs: any[]) => { let annotation: Annotation = new AnnotationClass(...handlerArgs); @@ -23,13 +29,10 @@ export class Decorator { const [target, propertyKey, descriptorOrParameterIndex] = decoratorArgs; - // let type = typeof decoratorArgs[0] === 'function' ? decoratorArgs[0].prototype : decoratorArgs[0]; - // let clazz = TypeUtil.getClass(decoratorArgs[0]); - if (typeof(annotation.metadataKey) === 'undefined') { - throw new Error(`Annotation[@${name}] must be implements metadataKey().`); - } - let metadataKey: MetadataKeyType = annotation.metadataKey.call(annotation); - Metadata.set(metadataKey, annotation, target, propertyKey); + let clazz: Class = Class._defineClass(TypeUtil.getClass(target)); + let field: Field = null; + let method: Method = null; + let parameter: Parameter = null; switch(decoratorType) { case DecoratorType.CLASS: @@ -37,24 +40,40 @@ export class Decorator { throw new Error(`Cannot apply @${name} decorator on Class.`); } + clazz._addAnnotation(annotation); + return annotation.classDecorator.call(annotation, target); case DecoratorType.PROPERTY: if (typeof(annotation.propertyDecorator) === 'undefined') { throw new Error(`Cannot apply @${name} decorator on Property.`); } + field = clazz._defineField(propertyKey, Metadata.getOwnType(target, propertyKey)); + field._addAnnotation(annotation); + return annotation.propertyDecorator.call(annotation, target, propertyKey); case DecoratorType.METHOD: if (typeof(annotation.methodDecorator) === 'undefined') { throw new Error(`Cannot apply @${name} decorator on Method.`); } + method = clazz._defineMethod(propertyKey, + Metadata.getOwnParamTypes(target, propertyKey), + Metadata.getOwnReturnType(target, propertyKey)); + method._addAnnotation(annotation); + return annotation.methodDecorator.call(annotation, target, propertyKey, descriptorOrParameterIndex); case DecoratorType.PARAMETER: if (typeof(annotation.parameterDecorator) === 'undefined') { throw new Error(`Cannot apply @${name} decorator on Parameter.`); } + method = clazz._defineMethod(propertyKey, + Metadata.getOwnParamTypes(target, propertyKey), + Metadata.getOwnReturnType(target, propertyKey)); + parameter = method.getParameter(descriptorOrParameterIndex); + parameter._addAnnotation(annotation); + return annotation.parameterDecorator.call(annotation, target, propertyKey, descriptorOrParameterIndex); default: throw new Error(`Cannot determine decorator[@${name}] type.`); diff --git a/src/ts/@overflow/commons/decorator/index.ts b/src/ts/@overflow/commons/decorator/index.ts index 23baea3..6b7a063 100644 --- a/src/ts/@overflow/commons/decorator/index.ts +++ b/src/ts/@overflow/commons/decorator/index.ts @@ -1,4 +1,2 @@ export * from './constants'; export * from './decorator'; - -export * from './annotation'; diff --git a/src/ts/@overflow/commons/redux/decorators/action_mapping.ts b/src/ts/@overflow/commons/redux/decorators/action_mapping.ts index fb2ee7b..da89782 100644 --- a/src/ts/@overflow/commons/redux/decorators/action_mapping.ts +++ b/src/ts/@overflow/commons/redux/decorators/action_mapping.ts @@ -1,3 +1,7 @@ +import { + Annotation, +} from '@overflow/commons/core/reflect'; + import { MetadataKeyType, PropertyKeyType, @@ -5,21 +9,17 @@ import { } from '@overflow/commons/core/type'; import { - Annotation, Decorator, } from '@overflow/commons/decorator'; -export const ActionMappingMetadataKey = Symbol('ActionMappingAnnotation'); - export interface ActionMappingAnnotationAttributes { value: string; } -export class ActionMappingAnnotation extends Annotation { +export class ActionMappingAnnotation implements Annotation { public readonly attributes: ActionMappingAnnotationAttributes; public constructor(value: string | ActionMappingAnnotationAttributes) { - super(); if (undefined === value) { throw new Error(`value attribute must be specified.`); @@ -34,10 +34,6 @@ export class ActionMappingAnnotation extends Annotation { } } - public metadataKey(): MetadataKeyType { - return ActionMappingMetadataKey; - } - public classDecorator(target: TFunction): TFunction | void { console.log('ActionMapping'); } diff --git a/src/ts/@overflow/commons/redux/decorators/reducer.ts b/src/ts/@overflow/commons/redux/decorators/reducer.ts index 2a2fec6..1bb7540 100644 --- a/src/ts/@overflow/commons/redux/decorators/reducer.ts +++ b/src/ts/@overflow/commons/redux/decorators/reducer.ts @@ -1,25 +1,24 @@ +import { + Annotation, +} from '@overflow/commons/core/reflect'; + import { MetadataKeyType, TypeUtil, } from '@overflow/commons/core/type'; import { - Annotation, Decorator, } from '@overflow/commons/decorator'; -export const ReducerMetadataKey = Symbol('ReducerAnnotation'); - export interface ReducerAnnotationAttributes { name?: string; } -export class ReducerAnnotation extends Annotation { +export class ReducerAnnotation implements Annotation { public readonly attributes: ReducerAnnotationAttributes; public constructor(name: string | ReducerAnnotationAttributes) { - super(); - if (undefined === name) { this.attributes = { name: '', @@ -36,10 +35,6 @@ export class ReducerAnnotation extends Annotation { } } - public metadataKey(): MetadataKeyType { - return ReducerMetadataKey; - } - public classDecorator(target: TFunction): TFunction | void { console.log('Reducer'); } diff --git a/src/ts/@overflow/commons/redux/decorators/rest_api.ts b/src/ts/@overflow/commons/redux/decorators/rest_api.ts index 5858e80..44b00fc 100644 --- a/src/ts/@overflow/commons/redux/decorators/rest_api.ts +++ b/src/ts/@overflow/commons/redux/decorators/rest_api.ts @@ -1,3 +1,7 @@ +import { + Annotation, +} from '@overflow/commons/core/reflect'; + import { MetadataKeyType, PropertyKeyType, @@ -5,22 +9,17 @@ import { } from '@overflow/commons/core/type'; import { - Annotation, Decorator, } from '@overflow/commons/decorator'; -export const RestAPIMetadataKey = Symbol('RestAPIAnnotation'); - export interface RestAPIAnnotationAttributes { entryPath: string; } -export class RestAPIAnnotation extends Annotation { +export class RestAPIAnnotation implements Annotation { public readonly attributes: RestAPIAnnotationAttributes; public constructor(entryPath: string | RestAPIAnnotationAttributes) { - super(); - if (undefined === entryPath) { throw new Error(`entryPath attribute must be specified.`); } @@ -34,10 +33,6 @@ export class RestAPIAnnotation extends Annotation { } } - public metadataKey(): MetadataKeyType { - return RestAPIMetadataKey; - } - public methodDecorator(target: Object, propertyKey: PropertyKeyType, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor | void { console.log('RestAPI'); diff --git a/src/ts/@overflow/commons/redux/decorators/rpc_api.ts b/src/ts/@overflow/commons/redux/decorators/rpc_api.ts index 9d085a5..71baf73 100644 --- a/src/ts/@overflow/commons/redux/decorators/rpc_api.ts +++ b/src/ts/@overflow/commons/redux/decorators/rpc_api.ts @@ -1,3 +1,7 @@ +import { + Annotation, +} from '@overflow/commons/core/reflect'; + import { MetadataKeyType, PropertyKeyType, @@ -5,22 +9,17 @@ import { } from '@overflow/commons/core/type'; import { - Annotation, Decorator, } from '@overflow/commons/decorator'; -export const RpcAPIMetadataKey = Symbol('RpcAPIAnnotation'); - export interface RpcAPIAnnotationAttributes { method: string; } -export class RpcAPIAnnotation extends Annotation { +export class RpcAPIAnnotation implements Annotation { public readonly attributes: RpcAPIAnnotationAttributes; public constructor(method: string | RpcAPIAnnotationAttributes) { - super(); - if (undefined === method) { throw new Error(`method attribute must be specified.`); } @@ -34,10 +33,6 @@ export class RpcAPIAnnotation extends Annotation { } } - public metadataKey(): MetadataKeyType { - return RpcAPIMetadataKey; - } - public methodDecorator(target: Object, propertyKey: PropertyKeyType, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor | void { console.log('RestAPI'); diff --git a/src/ts/@overflow/commons/redux/lpc_reducer.ts b/src/ts/@overflow/commons/redux/lpc_reducer.ts index 98efea1..627a99c 100644 --- a/src/ts/@overflow/commons/redux/lpc_reducer.ts +++ b/src/ts/@overflow/commons/redux/lpc_reducer.ts @@ -1,17 +1,17 @@ + import { - Action, -} from './action'; -import { - ConstructorType, + ClassType, Metadata, TypeUtil, } from '@overflow/commons/core/type'; import { ActionMappingAnnotation, - ActionMappingMetadataKey, - ReducerMetadataKey, ReducerAnnotation, + RestAPIAnnotation, + RpcAPIAnnotation, } from '@overflow/commons/redux/decorators'; +import { Class } from '@overflow/commons/core/reflect'; +import { Action } from '@overflow/commons/redux/action'; export default class LPCReducer { @@ -45,27 +45,31 @@ export default class LPCReducer { /** * registerReducers */ - public registerReducers(reducerTypes: ConstructorType[]): void { + public registerReducers(reducerTypes: ClassType[]): void { for (let reducerType of reducerTypes) { - let ra: ReducerAnnotation = Metadata.get(ReducerMetadataKey, reducerType); + 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 = Metadata.get(ActionMappingMetadataKey, reducerType); + let ama: ActionMappingAnnotation = clazz.getOwnAnnotation(ActionMappingAnnotation); if (undefined === ama) { continue; } console.log(`actionMapping-value: ${ama.attributes.value}`); - let properties = Object.keys(reducerType.prototype); - for (let propertyKey of properties) { - if (!TypeUtil.isMethod(reducerType.prototype, propertyKey)) { - console.log(`property: ${propertyKey}`); - continue; + clazz.getMethods().forEach(method => { + let restAPIAnnotation: RestAPIAnnotation = method.getOwnAnnotation(RestAPIAnnotation); + let rpcAPIAnnotation: RpcAPIAnnotation = method.getOwnAnnotation(RpcAPIAnnotation); + if (restAPIAnnotation) { + console.log(`restAPI: ${restAPIAnnotation.attributes.entryPath}`); } - console.log(`method: ${propertyKey}`); - } + if (rpcAPIAnnotation) { + console.log(`restAPI: ${rpcAPIAnnotation.attributes.method}`); + } + }); + } } @@ -73,7 +77,7 @@ export default class LPCReducer { /** * registerReducer */ - public registerReducer(reducerType: ConstructorType): void { + public registerReducer(reducerType: ClassType): void { console.log(``); } diff --git a/src/ts/@overflow/modules/member/reducer/member_reducer.ts b/src/ts/@overflow/modules/member/reducer/member_reducer.ts index 2c5cef0..2e9d6fd 100644 --- a/src/ts/@overflow/modules/member/reducer/member_reducer.ts +++ b/src/ts/@overflow/modules/member/reducer/member_reducer.ts @@ -7,7 +7,6 @@ import { @Reducer() @ActionMapping('@overflow/modules/member/MemberReducer') export default class MemberReducer { - public path: string; /** * signin */