Skip to content

Commit 9b79e09

Browse files
Devashish Bhattacharjeeodrotbohm
authored andcommitted
GH-256 - Added Kotlin variant for Java code.
1 parent 6653bcb commit 9b79e09

File tree

7 files changed

+550
-39
lines changed

7 files changed

+550
-39
lines changed

src/docs/antora/modules/ROOT/pages/documentation.adoc

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ Spring Modulith's `Documenter` abstraction can produce two different kinds of sn
1313
The documentation snippets can be generated by handing the `ApplicationModules` instance into a `Documenter`.
1414

1515
.Generating application module component diagrams using `Documenter`
16-
[source, java]
16+
[tabs]
17+
======
18+
Java::
19+
+
20+
[source, java, role="primary"]
1721
----
1822
class DocumentationTests {
1923
@@ -28,6 +32,22 @@ class DocumentationTests {
2832
}
2933
}
3034
----
35+
Kotlin::
36+
+
37+
[source, kotlin, role="secondary"]
38+
----
39+
class DocumentationTests {
40+
private val modules = ApplicationModules.of(Application::class)
41+
42+
@Test
43+
fun writeDocumentationSnippets() {
44+
Documenter(modules)
45+
.writeModulesAsPlantUml()
46+
.writeIndividualModulesAsPlantUml()
47+
}
48+
}
49+
----
50+
======
3151

3252
The first call on `Documenter` will generate a C4 component diagram containing all modules within the system.
3353

@@ -90,13 +110,23 @@ SHOW_LEGEND()
90110
=== Using Traditional UML Component Diagrams
91111

92112
If you prefer the traditional UML style component diagrams, tweak the `DiagramOptions` to rather use that style as follows:
93-
94-
[source, java]
113+
[tabs]
114+
======
115+
Java::
116+
+
117+
[source, java, role="primary"]
95118
----
96119
DiagramOptions.defaults()
97120
.withStyle(DiagramStyle.UML);
98121
----
99-
122+
Kotlin::
123+
+
124+
[source, kotlin, role="secondary"]
125+
----
126+
DiagramOptions.defaults()
127+
.withStyle(DiagramStyle.UML)
128+
----
129+
======
100130
This will cause the diagrams to look like this:
101131

102132
.All modules and their relationships rendered as UML component diagram
@@ -184,7 +214,11 @@ package "Application" <<Container>> {
184214
The Application Module Canvases can be generated by calling `Documenter.writeModuleCanvases()`:
185215

186216
.Generating application module canvases using `Documenter`
187-
[source, java]
217+
[tabs]
218+
======
219+
Java::
220+
+
221+
[source, java, role="primary"]
188222
----
189223
class DocumentationTests {
190224
@@ -198,7 +232,22 @@ class DocumentationTests {
198232
}
199233
}
200234
----
235+
Kotlin::
236+
+
237+
[source, kotlin, role="secondary"]
238+
----
239+
class DocumentationTests {
240+
241+
private val modules = ApplicationModules.of(Application::class)
201242
243+
@Test
244+
fun writeDocumentationSnippets() {
245+
Documenter(modules)
246+
.writeModuleCanvases()
247+
}
248+
}
249+
----
250+
======
202251
By default, the documentation will be generated to `spring-modulith-docs` folder in your build system's build folder.
203252
A generated canvas looks like this:
204253

0 commit comments

Comments
 (0)