UNPKG

node-web-mvc

Version:
35 lines (34 loc) 1.75 kB
/** * 注解索引,用于快速获取指定类下相关注解 */ import IRuntimeAnnotation from './IRuntimeAnnotation'; import { IAnnotation, IAnnotationClazz, IAnnotationOrClazz } from './type'; interface MethodIndexer { annotations: Map<Function, IRuntimeAnnotation[]>; parameters: { [x: string]: Map<Function, IRuntimeAnnotation[]>; }; } export default class AnnotationIndexer { clazz: Map<Function, IRuntimeAnnotation[]>; owner?: Function; properties: { [x: string]: Map<Function, IRuntimeAnnotation[]>; }; methods: Map<Function, MethodIndexer>; static createIndexerIfNeed(ctor: Function): AnnotationIndexer; static getIndexer(ctor: Function): AnnotationIndexer; static getMethodIndexer(clazz: Function, method: string | Function): MethodIndexer; constructor(); private createMethodIndexer; private cacheAnnotation; addAnnotation(annotation: IRuntimeAnnotation): void; static getClazzAnnotation(clazz: Function, annotationType: IAnnotationOrClazz): any; static getMethodAnnotation(clazz: Function, methodKey: string | Function, annotationType: IAnnotationOrClazz): any; static getPropertyAnnotation(clazz: Function, name: string, annotationType: IAnnotationOrClazz): any; static getParameterAnnotation(clazz: Function, methodKey: string | Function, paramName: string, annotationType: IAnnotationOrClazz): any; static findAnnotation(info: Map<Function, IRuntimeAnnotation[]>, annotationType?: IAnnotationOrClazz): any; static findAnnotations(info: Map<Function, IRuntimeAnnotation[]>, annotationType?: IAnnotationOrClazz): any; static isAnnotationTypeOf(m: IRuntimeAnnotation, type: IAnnotation | IAnnotationClazz): boolean; } export {};