-
Notifications
You must be signed in to change notification settings - Fork 242
/
examples.test.ts.snap
2658 lines (2247 loc) · 78.7 KB
/
examples.test.ts.snap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`diamond-struct-parameter.ts: <outDir>/ 1`] = `
<root>
┣━ 📁 dotnet
┃ ┗━ 📁 Example.Test.Demo
┃ ┣━ 📄 AssemblyInfo.cs
┃ ┣━ 📁 Example
┃ ┃ ┗━ 📁 Test
┃ ┃ ┗━ 📁 Demo
┃ ┃ ┣━ 📄 Baz_.cs
┃ ┃ ┣━ 📄 Consumer.cs
┃ ┃ ┣━ 📄 Foo_.cs
┃ ┃ ┣━ 📄 FooBar.cs
┃ ┃ ┣━ 📄 IBaz.cs
┃ ┃ ┣━ 📄 IFoo.cs
┃ ┃ ┣━ 📄 IFooBar.cs
┃ ┃ ┗━ 📁 Internal
┃ ┃ ┗━ 📁 DependencyResolution
┃ ┃ ┗━ 📄 Anchor.cs
┃ ┗━ 📄 Example.Test.Demo.csproj
┣━ 📁 go
┃ ┗━ 📁 testpkg
┃ ┣━ 📄 go.mod
┃ ┣━ 📁 jsii
┃ ┃ ┗━ 📄 jsii.go
┃ ┣━ 📄 testpkg.go
┃ ┗━ 📄 testpkg.init.go
┣━ 📁 java
┃ ┣━ 📄 pom.xml
┃ ┗━ 📁 src
┃ ┗━ 📁 main
┃ ┣━ 📁 java
┃ ┃ ┗━ 📁 example
┃ ┃ ┗━ 📁 test
┃ ┃ ┗━ 📁 demo
┃ ┃ ┣━ 📄 $Module.java
┃ ┃ ┣━ 📄 Baz.java
┃ ┃ ┣━ 📄 Consumer.java
┃ ┃ ┣━ 📄 Foo.java
┃ ┃ ┗━ 📄 FooBar.java
┃ ┗━ 📁 resources
┃ ┗━ 📁 example
┃ ┗━ 📁 test
┃ ┗━ 📁 demo
┃ ┗━ 📄 $Module.txt
┗━ 📁 python
┣━ 📄 pyproject.toml
┣━ 📄 setup.py
┗━ 📁 src
┗━ 📁 example_test_demo
┣━ 📄 __init__.py
┣━ 📁 _jsii
┃ ┗━ 📄 __init__.py
┗━ 📄 py.typed
`;
exports[`diamond-struct-parameter.ts: <outDir>/dotnet/Example.Test.Demo/AssemblyInfo.cs 1`] = `
using Amazon.JSII.Runtime.Deputy;
[assembly: JsiiAssembly("testpkg", "0.0.1", "testpkg-0.0.1.tgz")]
`;
exports[`diamond-struct-parameter.ts: <outDir>/dotnet/Example.Test.Demo/Example.Test.Demo.csproj 1`] = `
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- Package Identification -->
<Description>testpkg</Description>
<PackageId>Example.Test.Demo</PackageId>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageVersion>0.0.1</PackageVersion>
<!-- Additional Metadata -->
<Authors>John Doe</Authors>
<Language>en-US</Language>
<ProjectUrl>https://github.com/aws/jsii.git</ProjectUrl>
<RepositoryUrl>https://github.com/aws/jsii.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<!-- Build Configuration -->
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IncludeSymbols>true</IncludeSymbols>
<IncludeSource>true</IncludeSource>
<Nullable>enable</Nullable>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="testpkg-0.0.1.tgz" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Amazon.JSII.Runtime" Version="[0.0.0,)" />
</ItemGroup>
<PropertyGroup>
<!-- Silence [Obsolete] warnings -->
<NoWarn>0612,0618</NoWarn>
<!-- Treat warnings symptomatic of code generation bugs as errors -->
<WarningsAsErrors>0108,0109</WarningsAsErrors>
</PropertyGroup>
</Project>
`;
exports[`diamond-struct-parameter.ts: <outDir>/dotnet/Example.Test.Demo/Example/Test/Demo/Baz_.cs 1`] = `
using Amazon.JSII.Runtime.Deputy;
#pragma warning disable CS0672,CS0809,CS1591
namespace Example.Test.Demo
{
#pragma warning disable CS8618
[JsiiByValue(fqn: "testpkg.Baz")]
public class Baz_ : Example.Test.Demo.IBaz
{
[JsiiProperty(name: "baz", typeJson: "{\\"primitive\\":\\"boolean\\"}")]
public bool Baz
{
get;
set;
}
[JsiiProperty(name: "foo", typeJson: "{\\"primitive\\":\\"number\\"}")]
public double Foo
{
get;
set;
}
[JsiiOptional]
[JsiiProperty(name: "bar", typeJson: "{\\"primitive\\":\\"string\\"}", isOptional: true)]
public string? Bar
{
get;
set;
}
}
}
`;
exports[`diamond-struct-parameter.ts: <outDir>/dotnet/Example.Test.Demo/Example/Test/Demo/Consumer.cs 1`] = `
using Amazon.JSII.Runtime.Deputy;
#pragma warning disable CS0672,CS0809,CS1591
namespace Example.Test.Demo
{
[JsiiClass(nativeType: typeof(Example.Test.Demo.Consumer), fullyQualifiedName: "testpkg.Consumer")]
public class Consumer : DeputyBase
{
/// <summary>Used by jsii to construct an instance of this class from a Javascript-owned object reference</summary>
/// <param name="reference">The Javascript-owned object reference</param>
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
protected Consumer(ByRefValue reference): base(reference)
{
}
/// <summary>Used by jsii to construct an instance of this class from DeputyProps</summary>
/// <param name="props">The deputy props</param>
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
protected Consumer(DeputyProps props): base(props)
{
}
[JsiiMethod(name: "consumeBaz", parametersJson: "[{\\"name\\":\\"baz\\",\\"type\\":{\\"fqn\\":\\"testpkg.Baz\\"}}]")]
public static void ConsumeBaz(Example.Test.Demo.IBaz baz)
{
InvokeStaticVoidMethod(typeof(Example.Test.Demo.Consumer), new System.Type[]{typeof(Example.Test.Demo.IBaz)}, new object[]{baz});
}
}
}
`;
exports[`diamond-struct-parameter.ts: <outDir>/dotnet/Example.Test.Demo/Example/Test/Demo/Foo_.cs 1`] = `
using Amazon.JSII.Runtime.Deputy;
#pragma warning disable CS0672,CS0809,CS1591
namespace Example.Test.Demo
{
#pragma warning disable CS8618
[JsiiByValue(fqn: "testpkg.Foo")]
public class Foo_ : Example.Test.Demo.IFoo
{
[JsiiProperty(name: "foo", typeJson: "{\\"primitive\\":\\"number\\"}")]
public double Foo
{
get;
set;
}
}
}
`;
exports[`diamond-struct-parameter.ts: <outDir>/dotnet/Example.Test.Demo/Example/Test/Demo/FooBar.cs 1`] = `
using Amazon.JSII.Runtime.Deputy;
#pragma warning disable CS0672,CS0809,CS1591
namespace Example.Test.Demo
{
#pragma warning disable CS8618
[JsiiByValue(fqn: "testpkg.FooBar")]
public class FooBar : Example.Test.Demo.IFooBar
{
[JsiiProperty(name: "foo", typeJson: "{\\"primitive\\":\\"number\\"}")]
public double Foo
{
get;
set;
}
[JsiiOptional]
[JsiiProperty(name: "bar", typeJson: "{\\"primitive\\":\\"string\\"}", isOptional: true)]
public string? Bar
{
get;
set;
}
}
}
`;
exports[`diamond-struct-parameter.ts: <outDir>/dotnet/Example.Test.Demo/Example/Test/Demo/IBaz.cs 1`] = `
using Amazon.JSII.Runtime.Deputy;
#pragma warning disable CS0672,CS0809,CS1591
namespace Example.Test.Demo
{
[JsiiInterface(nativeType: typeof(IBaz), fullyQualifiedName: "testpkg.Baz")]
public interface IBaz : Example.Test.Demo.IFoo, Example.Test.Demo.IFooBar
{
[JsiiProperty(name: "baz", typeJson: "{\\"primitive\\":\\"boolean\\"}")]
bool Baz
{
get;
}
[JsiiTypeProxy(nativeType: typeof(IBaz), fullyQualifiedName: "testpkg.Baz")]
new internal sealed class _Proxy : DeputyBase, Example.Test.Demo.IBaz
{
private _Proxy(ByRefValue reference): base(reference)
{
}
[JsiiProperty(name: "baz", typeJson: "{\\"primitive\\":\\"boolean\\"}")]
public bool Baz
{
get => GetInstanceProperty<bool>()!;
}
[JsiiProperty(name: "foo", typeJson: "{\\"primitive\\":\\"number\\"}")]
public double Foo
{
get => GetInstanceProperty<double>()!;
}
[JsiiOptional]
[JsiiProperty(name: "bar", typeJson: "{\\"primitive\\":\\"string\\"}", isOptional: true)]
public string? Bar
{
get => GetInstanceProperty<string?>();
}
}
}
}
`;
exports[`diamond-struct-parameter.ts: <outDir>/dotnet/Example.Test.Demo/Example/Test/Demo/IFoo.cs 1`] = `
using Amazon.JSII.Runtime.Deputy;
#pragma warning disable CS0672,CS0809,CS1591
namespace Example.Test.Demo
{
[JsiiInterface(nativeType: typeof(IFoo), fullyQualifiedName: "testpkg.Foo")]
public interface IFoo
{
[JsiiProperty(name: "foo", typeJson: "{\\"primitive\\":\\"number\\"}")]
double Foo
{
get;
}
[JsiiTypeProxy(nativeType: typeof(IFoo), fullyQualifiedName: "testpkg.Foo")]
internal sealed class _Proxy : DeputyBase, Example.Test.Demo.IFoo
{
private _Proxy(ByRefValue reference): base(reference)
{
}
[JsiiProperty(name: "foo", typeJson: "{\\"primitive\\":\\"number\\"}")]
public double Foo
{
get => GetInstanceProperty<double>()!;
}
}
}
}
`;
exports[`diamond-struct-parameter.ts: <outDir>/dotnet/Example.Test.Demo/Example/Test/Demo/IFooBar.cs 1`] = `
using Amazon.JSII.Runtime.Deputy;
#pragma warning disable CS0672,CS0809,CS1591
namespace Example.Test.Demo
{
[JsiiInterface(nativeType: typeof(IFooBar), fullyQualifiedName: "testpkg.FooBar")]
public interface IFooBar
{
[JsiiProperty(name: "foo", typeJson: "{\\"primitive\\":\\"number\\"}")]
double Foo
{
get;
}
[JsiiProperty(name: "bar", typeJson: "{\\"primitive\\":\\"string\\"}", isOptional: true)]
[Amazon.JSII.Runtime.Deputy.JsiiOptional]
string? Bar
{
get
{
return null;
}
}
[JsiiTypeProxy(nativeType: typeof(IFooBar), fullyQualifiedName: "testpkg.FooBar")]
internal sealed class _Proxy : DeputyBase, Example.Test.Demo.IFooBar
{
private _Proxy(ByRefValue reference): base(reference)
{
}
[JsiiProperty(name: "foo", typeJson: "{\\"primitive\\":\\"number\\"}")]
public double Foo
{
get => GetInstanceProperty<double>()!;
}
[JsiiOptional]
[JsiiProperty(name: "bar", typeJson: "{\\"primitive\\":\\"string\\"}", isOptional: true)]
public string? Bar
{
get => GetInstanceProperty<string?>();
}
}
}
}
`;
exports[`diamond-struct-parameter.ts: <outDir>/dotnet/Example.Test.Demo/Example/Test/Demo/Internal/DependencyResolution/Anchor.cs 1`] = `
#pragma warning disable CS0672,CS0809,CS1591
namespace Example.Test.Demo.Internal.DependencyResolution
{
public sealed class Anchor
{
public Anchor()
{
}
}
}
`;
exports[`diamond-struct-parameter.ts: <outDir>/go/testpkg/go.mod 1`] = `
module example.test/demo/testpkg
go 1.16
require (
github.com/aws/jsii-runtime-go v0.0.0
)
`;
exports[`diamond-struct-parameter.ts: <outDir>/go/testpkg/jsii/jsii.go 1`] = `
// Package jsii contains the functionaility needed for jsii packages to
// initialize their dependencies and themselves. Users should never need to use this package
// directly. If you find you need to - please report a bug at
// https://github.com/aws/jsii/issues/new/choose
package jsii
import (
_ "embed"
_jsii_ "github.com/aws/jsii-runtime-go/runtime"
)
//go:embed testpkg-0.0.1.tgz
var tarball []byte
// Initialize loads the necessary packages in the @jsii/kernel to support the enclosing module.
// The implementation is idempotent (and hence safe to be called over and over).
func Initialize() {
// Load this library into the kernel
_jsii_.Load("testpkg", "0.0.1", tarball)
}
`;
exports[`diamond-struct-parameter.ts: <outDir>/go/testpkg/testpkg.go 1`] = `
// testpkg
package testpkg
import (
_init_ "example.test/demo/testpkg/jsii"
_jsii_ "github.com/aws/jsii-runtime-go/runtime"
)
type Baz struct {
Foo *float64 \`json:"foo" yaml:"foo"\`
Bar *string \`json:"bar" yaml:"bar"\`
Baz *bool \`json:"baz" yaml:"baz"\`
}
type Consumer interface {
}
// The jsii proxy struct for Consumer
type jsiiProxy_Consumer struct {
_ byte // padding
}
func Consumer_ConsumeBaz(baz *Baz) {
_init_.Initialize()
_jsii_.StaticInvokeVoid(
"testpkg.Consumer",
"consumeBaz",
[]interface{}{baz},
)
}
type Foo struct {
Foo *float64 \`json:"foo" yaml:"foo"\`
}
type FooBar struct {
Foo *float64 \`json:"foo" yaml:"foo"\`
Bar *string \`json:"bar" yaml:"bar"\`
}
`;
exports[`diamond-struct-parameter.ts: <outDir>/go/testpkg/testpkg.init.go 1`] = `
package testpkg
import (
"reflect"
_jsii_ "github.com/aws/jsii-runtime-go/runtime"
)
func init() {
_jsii_.RegisterStruct(
"testpkg.Baz",
reflect.TypeOf((*Baz)(nil)).Elem(),
)
_jsii_.RegisterClass(
"testpkg.Consumer",
reflect.TypeOf((*Consumer)(nil)).Elem(),
nil, // no members
func() interface{} {
return &jsiiProxy_Consumer{}
},
)
_jsii_.RegisterStruct(
"testpkg.Foo",
reflect.TypeOf((*Foo)(nil)).Elem(),
)
_jsii_.RegisterStruct(
"testpkg.FooBar",
reflect.TypeOf((*FooBar)(nil)).Elem(),
)
}
`;
exports[`diamond-struct-parameter.ts: <outDir>/java/pom.xml 1`] = `
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<name>\${project.groupId}:\${project.artifactId}</name>
<description>testpkg</description>
<url>https://github.com/aws/jsii.git</url>
<licenses>
<license>
<name>Apache License 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
<distribution>repo</distribution>
<comments>An OSI-approved license</comments>
</license>
</licenses>
<developers>
<developer>
<name>John Doe</name>
<roles>
<role>author</role>
</roles>
</developer>
</developers>
<scm>
<connection>scm:git:https://github.com/aws/jsii.git</connection>
<url>https://github.com/aws/jsii.git</url>
</scm>
<groupId>example.test</groupId>
<artifactId>demo</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>software.amazon.jsii</groupId>
<artifactId>jsii-runtime</artifactId>
<version>[0.0.0,)</version>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>[16.0.3,20.0.0)</version>
</dependency>
<dependency>
<!-- Provides @javax.annotation.Generated for JDKs >= 9 -->
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>[1.3.2,1.4.0)</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<index>true</index>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<failOnError>false</failOnError>
<show>protected</show>
<sourceFileExcludes>
<exclude>**/$Module.java</exclude>
</sourceFileExcludes>
<additionalJOption>-J-XX:+TieredCompilation</additionalJOption>
<additionalJOption>-J-XX:TieredStopAtLevel=1</additionalJOption>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.6</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<generateBackupPoms>false</generateBackupPoms>
</configuration>
</plugin>
</plugins>
</build>
</project>
`;
exports[`diamond-struct-parameter.ts: <outDir>/java/src/main/java/example/test/demo/$Module.java 1`] = `
package example.test.demo;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.Reader;
import java.io.UncheckedIOException;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import software.amazon.jsii.JsiiModule;
@software.amazon.jsii.Internal
public final class $Module extends JsiiModule {
private static final Map<String, String> MODULE_TYPES = load();
private static Map<String, String> load() {
final Map<String, String> result = new HashMap<>();
final ClassLoader cl = $Module.class.getClassLoader();
try (final InputStream is = cl.getResourceAsStream("example/test/demo/$Module.txt");
final Reader rd = new InputStreamReader(is, StandardCharsets.UTF_8);
final BufferedReader br = new BufferedReader(rd)) {
br.lines()
.filter(line -> !line.trim().isEmpty())
.forEach(line -> {
final String[] parts = line.split("=", 2);
final String fqn = parts[0];
final String className = parts[1];
result.put(fqn, className);
});
}
catch (final IOException exception) {
throw new UncheckedIOException(exception);
}
return result;
}
private final Map<String, Class<?>> cache = new HashMap<>();
public $Module() {
super("testpkg", "0.0.1", $Module.class, "testpkg@0.0.1.jsii.tgz");
}
@Override
protected Class<?> resolveClass(final String fqn) throws ClassNotFoundException {
if (!MODULE_TYPES.containsKey(fqn)) {
throw new ClassNotFoundException("Unknown JSII type: " + fqn);
}
String className = MODULE_TYPES.get(fqn);
if (!this.cache.containsKey(className)) {
this.cache.put(className, this.findClass(className));
}
return this.cache.get(className);
}
private Class<?> findClass(final String binaryName) {
try {
return Class.forName(binaryName);
}
catch (final ClassNotFoundException exception) {
throw new RuntimeException(exception);
}
}
}
`;
exports[`diamond-struct-parameter.ts: <outDir>/java/src/main/java/example/test/demo/Baz.java 1`] = `
package example.test.demo;
@javax.annotation.Generated(value = "jsii-pacmak")
@software.amazon.jsii.Jsii(module = example.test.demo.$Module.class, fqn = "testpkg.Baz")
@software.amazon.jsii.Jsii.Proxy(Baz.Jsii$Proxy.class)
public interface Baz extends software.amazon.jsii.JsiiSerializable, example.test.demo.Foo, example.test.demo.FooBar {
@org.jetbrains.annotations.NotNull java.lang.Boolean getBaz();
@org.jetbrains.annotations.NotNull java.lang.Number getFoo();
/**
* @return a {@link Builder} of {@link Baz}
*/
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link Baz}
*/
public static final class Builder implements software.amazon.jsii.Builder<Baz> {
java.lang.Boolean baz;
java.lang.Number foo;
java.lang.String bar;
/**
* Sets the value of {@link Baz#getBaz}
* @param baz the value to be set. This parameter is required.
* @return {@code this}
*/
public Builder baz(java.lang.Boolean baz) {
this.baz = baz;
return this;
}
/**
* Sets the value of {@link Baz#getFoo}
* @param foo the value to be set. This parameter is required.
* @return {@code this}
*/
public Builder foo(java.lang.Number foo) {
this.foo = foo;
return this;
}
/**
* Sets the value of {@link Baz#getBar}
* @param bar the value to be set.
* @return {@code this}
*/
public Builder bar(java.lang.String bar) {
this.bar = bar;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link Baz}
* @throws NullPointerException if any required attribute was not provided
*/
@Override
public Baz build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link Baz}
*/
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements Baz {
private final java.lang.Boolean baz;
private final java.lang.Number foo;
private final java.lang.String bar;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.baz = software.amazon.jsii.Kernel.get(this, "baz", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.foo = software.amazon.jsii.Kernel.get(this, "foo", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.bar = software.amazon.jsii.Kernel.get(this, "bar", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.baz = java.util.Objects.requireNonNull(builder.baz, "baz is required");
this.foo = java.util.Objects.requireNonNull(builder.foo, "foo is required");
this.bar = builder.bar;
}
@Override
public final java.lang.Boolean getBaz() {
return this.baz;
}
@Override
public final java.lang.Number getFoo() {
return this.foo;
}
@Override
public final java.lang.String getBar() {
return this.bar;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
data.set("baz", om.valueToTree(this.getBaz()));
data.set("foo", om.valueToTree(this.getFoo()));
if (this.getBar() != null) {
data.set("bar", om.valueToTree(this.getBar()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("testpkg.Baz"));
struct.set("data", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set("$jsii.struct", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Baz.Jsii$Proxy that = (Baz.Jsii$Proxy) o;
if (!baz.equals(that.baz)) return false;
if (!foo.equals(that.foo)) return false;
return this.bar != null ? this.bar.equals(that.bar) : that.bar == null;
}
@Override
public final int hashCode() {
int result = this.baz.hashCode();
result = 31 * result + (this.foo.hashCode());
result = 31 * result + (this.bar != null ? this.bar.hashCode() : 0);
return result;
}
}
}
`;
exports[`diamond-struct-parameter.ts: <outDir>/java/src/main/java/example/test/demo/Consumer.java 1`] = `
package example.test.demo;
@javax.annotation.Generated(value = "jsii-pacmak")
@software.amazon.jsii.Jsii(module = example.test.demo.$Module.class, fqn = "testpkg.Consumer")
public class Consumer extends software.amazon.jsii.JsiiObject {
protected Consumer(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected Consumer(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
public static void consumeBaz(final @org.jetbrains.annotations.NotNull example.test.demo.Baz baz) {
software.amazon.jsii.JsiiObject.jsiiStaticCall(example.test.demo.Consumer.class, "consumeBaz", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(baz, "baz is required") });
}
}
`;
exports[`diamond-struct-parameter.ts: <outDir>/java/src/main/java/example/test/demo/Foo.java 1`] = `
package example.test.demo;
@javax.annotation.Generated(value = "jsii-pacmak")
@software.amazon.jsii.Jsii(module = example.test.demo.$Module.class, fqn = "testpkg.Foo")
@software.amazon.jsii.Jsii.Proxy(Foo.Jsii$Proxy.class)
public interface Foo extends software.amazon.jsii.JsiiSerializable {
@org.jetbrains.annotations.NotNull java.lang.Number getFoo();
/**
* @return a {@link Builder} of {@link Foo}
*/
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link Foo}
*/
public static final class Builder implements software.amazon.jsii.Builder<Foo> {
java.lang.Number foo;
/**
* Sets the value of {@link Foo#getFoo}
* @param foo the value to be set. This parameter is required.
* @return {@code this}
*/
public Builder foo(java.lang.Number foo) {
this.foo = foo;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link Foo}
* @throws NullPointerException if any required attribute was not provided
*/
@Override
public Foo build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link Foo}
*/
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements Foo {
private final java.lang.Number foo;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.foo = software.amazon.jsii.Kernel.get(this, "foo", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.foo = java.util.Objects.requireNonNull(builder.foo, "foo is required");
}
@Override
public final java.lang.Number getFoo() {
return this.foo;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
data.set("foo", om.valueToTree(this.getFoo()));
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("testpkg.Foo"));
struct.set("data", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set("$jsii.struct", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Foo.Jsii$Proxy that = (Foo.Jsii$Proxy) o;
return this.foo.equals(that.foo);
}
@Override
public final int hashCode() {
int result = this.foo.hashCode();
return result;
}
}
}
`;