UNPKG

node-web-mvc

Version:
29 lines (28 loc) 1.41 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.RequestMapping = void 0; const Target_1 = __importDefault(require("../Target")); const RuntimeAnnotation_1 = __importDefault(require("../annotation/RuntimeAnnotation")); const ElementType_1 = __importDefault(require("../annotation/ElementType")); class RequestMapping { static getMappingInfo(clazz, method) { var _a; const anno = RuntimeAnnotation_1.default.getMethodAnnotation(clazz, method, RequestMapping); return (_a = anno === null || anno === void 0 ? void 0 : anno.nativeAnnotation) === null || _a === void 0 ? void 0 : _a.mapping; } } exports.RequestMapping = RequestMapping; /** * 映射指定控制器以及控制器下的函数的请求路径 * 例如: * * @RequestMapping('/user/') * @RequestMapping(['/user','/hello'],'GET') * @RequestMapping('/user','POST','application/json') * RequestMapping({ value:'/user',method:'POST',produces:'application/json',consumes:'' }) * @param {String/Object/Array} value 可以为对象,或者为path的字符串数组 '/user' ['/user' ] { value:'xxx',method:'' } */ exports.default = (0, Target_1.default)([ElementType_1.default.TYPE, ElementType_1.default.METHOD])(RequestMapping);