node-web-mvc
Version:
node spring mvc
65 lines (64 loc) • 2.19 kB
TypeScript
/**
* @module MethodParameter
* @description 请求参数配置类
*/
import RuntimeAnnotation from '../annotations/annotation/RuntimeAnnotation';
import { IAnnotationClazz, MetaRuntimeTypeInfo } from '../annotations/annotation/type';
export type RequestParamType = 'path' | 'query' | 'body' | 'header' | 'form' | 'part' | '';
export default class MethodParameter {
/**
* 当前参数所属函数
*/
readonly method: string;
/**
* 当前参数所属函数对应的类
*/
readonly beanType: Function;
/**
* 参数名称
*/
readonly paramName: string;
/**
* 参数所在函数签名下标
*/
readonly paramIndex: number;
/**
* 参数类型
*/
readonly parameterType: Function;
/**
* 补充的运行时类型
*/
readonly runtimeType?: MetaRuntimeTypeInfo;
/**
* 判断当前参数是否存在指定注解
*/
hasParameterAnnotation<C extends IAnnotationClazz>(annotationType: C): boolean;
hasClassAnnotation<C extends IAnnotationClazz>(annotationType: C): boolean;
hasMethodAnnotation<C extends IAnnotationClazz>(annotationType: C): boolean;
/**
* 获取当前参数注解
*/
getParameterAnnotation<T extends IAnnotationClazz>(annotationType: T): T extends {
NativeAnnotation: abstract new (...args: any) => infer A;
} ? A : T extends abstract new (...args: any[]) => infer A_1 ? A_1 : T;
/**
* 获取当前参数上的所有注解
* @returns
*/
getParameterAnnotations(): RuntimeAnnotation<any>[];
/**
* 判断当前paramterType类型是否为指定类型(包含继承判定)
*/
isParamAssignableOf(parentType: Function): any;
isExtParamAssignableOf(i: number, parentType: Function): any;
getParameterGenericTypeOf(i: number): import("../..").ClazzType;
isMultipartAccept(): any;
/**
* 构造一个方法参数
* @param options 参数配置
* @param paramType 参数类型
* @param annotation 所属原始注解
*/
constructor(beanType: Function, method: string, paramName: string, paramIndex: number, parameterType: MetaRuntimeTypeInfo);
}