1 | import * as spec from '@jsii/spec';
|
2 | import { CodeMaker } from 'codemaker';
|
3 | import * as reflect from 'jsii-reflect';
|
4 |
|
5 |
|
6 |
|
7 | export interface GeneratorOptions {
|
8 | |
9 |
|
10 |
|
11 |
|
12 |
|
13 | expandUnionProperties?: boolean;
|
14 | |
15 |
|
16 |
|
17 |
|
18 | generateOverloadsForMethodWithOptionals?: boolean;
|
19 | |
20 |
|
21 |
|
22 | addBasePostfixToAbstractClassNames?: boolean;
|
23 | |
24 |
|
25 |
|
26 |
|
27 | runtimeTypeChecking: boolean;
|
28 | }
|
29 | export interface IGenerator {
|
30 | |
31 |
|
32 |
|
33 |
|
34 | generate(fingerprint: boolean): void;
|
35 | |
36 |
|
37 |
|
38 |
|
39 | load(packageDir: string, assembly: reflect.Assembly): Promise<void>;
|
40 | |
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 | upToDate(outDir: string): Promise<boolean>;
|
50 | |
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 | save(outdir: string, tarball: string, legalese: Legalese): Promise<any>;
|
58 | }
|
59 | export interface Legalese {
|
60 | |
61 |
|
62 |
|
63 | readonly license?: string;
|
64 | |
65 |
|
66 |
|
67 | readonly notice?: string;
|
68 | }
|
69 |
|
70 |
|
71 |
|
72 |
|
73 | export declare abstract class Generator implements IGenerator {
|
74 | private readonly options;
|
75 | private readonly excludeTypes;
|
76 | protected readonly code: CodeMaker;
|
77 | private _assembly?;
|
78 | protected _reflectAssembly?: reflect.Assembly;
|
79 | private fingerprint?;
|
80 | constructor(options: GeneratorOptions);
|
81 | protected get runtimeTypeChecking(): boolean;
|
82 | protected get assembly(): spec.Assembly;
|
83 | get reflectAssembly(): reflect.Assembly;
|
84 | get metadata(): {
|
85 | fingerprint: string | undefined;
|
86 | };
|
87 | load(_packageRoot: string, assembly: reflect.Assembly): Promise<void>;
|
88 | |
89 |
|
90 |
|
91 | generate(fingerprint: boolean): void;
|
92 | upToDate(_: string): Promise<boolean>;
|
93 | |
94 |
|
95 |
|
96 | protected getAssemblyFileName(): string;
|
97 | |
98 |
|
99 |
|
100 | save(outdir: string, tarball: string, { license, notice }: Legalese): Promise<string[]>;
|
101 | |
102 |
|
103 |
|
104 | protected getAssemblyOutputDir(_mod: spec.Assembly): string | undefined;
|
105 | protected onBeginAssembly(_assm: spec.Assembly, _fingerprint: boolean): void;
|
106 | protected onEndAssembly(_assm: spec.Assembly, _fingerprint: boolean): void;
|
107 | protected onBeginNamespace(_ns: string): void;
|
108 | protected onEndNamespace(_ns: string): void;
|
109 | protected onBeginClass(_cls: spec.ClassType, _abstract: boolean | undefined): void;
|
110 | protected onEndClass(_cls: spec.ClassType): void;
|
111 | protected abstract onBeginInterface(ifc: spec.InterfaceType): void;
|
112 | protected abstract onEndInterface(ifc: spec.InterfaceType): void;
|
113 | protected abstract onInterfaceMethod(ifc: spec.InterfaceType, method: spec.Method): void;
|
114 | protected abstract onInterfaceMethodOverload(ifc: spec.InterfaceType, overload: spec.Method, originalMethod: spec.Method): void;
|
115 | protected abstract onInterfaceProperty(ifc: spec.InterfaceType, prop: spec.Property): void;
|
116 | protected onInitializer(_cls: spec.ClassType, _initializer: spec.Initializer): void;
|
117 | protected onInitializerOverload(_cls: spec.ClassType, _overload: spec.Initializer, _originalInitializer: spec.Initializer): void;
|
118 | protected onBeginProperties(_cls: spec.ClassType): void;
|
119 | protected abstract onProperty(cls: spec.ClassType, prop: spec.Property): void;
|
120 | protected abstract onStaticProperty(cls: spec.ClassType, prop: spec.Property): void;
|
121 | protected onEndProperties(_cls: spec.ClassType): void;
|
122 | protected abstract onUnionProperty(cls: spec.ClassType, prop: spec.Property, union: spec.UnionTypeReference): void;
|
123 | protected onExpandedUnionProperty(_cls: spec.ClassType, _prop: spec.Property, _primaryName: string): void;
|
124 | protected onBeginMethods(_cls: spec.ClassType): void;
|
125 | protected abstract onMethod(cls: spec.ClassType, method: spec.Method): void;
|
126 | protected abstract onMethodOverload(cls: spec.ClassType, overload: spec.Method, originalMethod: spec.Method): void;
|
127 | protected abstract onStaticMethod(cls: spec.ClassType, method: spec.Method): void;
|
128 | protected abstract onStaticMethodOverload(cls: spec.ClassType, overload: spec.Method, originalMethod: spec.Method): void;
|
129 | protected onEndMethods(_cls: spec.ClassType): void;
|
130 | protected onBeginEnum(_enm: spec.EnumType): void;
|
131 | protected onEndEnum(_enm: spec.EnumType): void;
|
132 | protected onEnumMember(_enm: spec.EnumType, _member: spec.EnumMember): void;
|
133 | protected hasField(_cls: spec.ClassType, _prop: spec.Property): boolean;
|
134 | protected onField(_cls: spec.ClassType, _prop: spec.Property, _union?: spec.UnionTypeReference): void;
|
135 | private visit;
|
136 | |
137 |
|
138 |
|
139 | private addAbstractPostfixToClassName;
|
140 | protected excludeType(...names: string[]): void;
|
141 | private shouldExcludeType;
|
142 | |
143 |
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 | protected createOverloadsForOptionals<T extends spec.Method | spec.Initializer>(method: T): T[];
|
152 | private visitInterface;
|
153 | private visitClass;
|
154 | |
155 |
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 | protected isPrimaryExpandedUnionProperty(ref: spec.UnionTypeReference | undefined, index: number): boolean;
|
164 | private visitEnum;
|
165 | private displayNameForType;
|
166 | |
167 |
|
168 |
|
169 |
|
170 | protected findModule(name: string): spec.AssemblyConfiguration;
|
171 | protected findType(fqn: string): spec.Type;
|
172 | }
|
173 |
|
\ | No newline at end of file |