1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const javaUtil_1 = require("./java/javaUtil");
|
4 | class CodegenModelFactory {
|
5 | |
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | static setTypeMapping(type, implementation) {
|
12 | if (!(implementation.prototype instanceof type.getDefaultImplementation())) {
|
13 | throw new Error(implementation + " doesn't extend " + type);
|
14 | }
|
15 | CodegenModelFactory.typeMapping.put(type, implementation);
|
16 | }
|
17 | static newInstance(type) {
|
18 | const classType = CodegenModelFactory.typeMapping.get(type) ||
|
19 | type.getDefaultImplementation();
|
20 | return new classType();
|
21 | }
|
22 | }
|
23 | exports.default = CodegenModelFactory;
|
24 | CodegenModelFactory.typeMapping = javaUtil_1.newHashMap();
|
25 |
|
\ | No newline at end of file |