1 | "use strict";
|
2 | var _a;
|
3 | Object.defineProperty(exports, "__esModule", { value: true });
|
4 | const constants_1 = require("../injector/constants");
|
5 | exports.HANDLER_METADATA_SYMBOL = Symbol.for('handler_metadata:cache');
|
6 | class HandlerMetadataStorage {
|
7 | constructor() {
|
8 | this[_a] = new Map();
|
9 | }
|
10 | set(controller, methodName, metadata) {
|
11 | const metadataKey = this.getMetadataKey(controller, methodName);
|
12 | this[exports.HANDLER_METADATA_SYMBOL].set(metadataKey, metadata);
|
13 | }
|
14 | get(controller, methodName) {
|
15 | const metadataKey = this.getMetadataKey(controller, methodName);
|
16 | return this[exports.HANDLER_METADATA_SYMBOL].get(metadataKey);
|
17 | }
|
18 | getMetadataKey(controller, methodName) {
|
19 | const ctor = controller.constructor;
|
20 | const controllerKey = ctor && (ctor[constants_1.CONTROLLER_ID_KEY] || ctor.name);
|
21 | return controllerKey + methodName;
|
22 | }
|
23 | }
|
24 | exports.HandlerMetadataStorage = HandlerMetadataStorage;
|
25 | _a = exports.HANDLER_METADATA_SYMBOL;
|