aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-10-30 17:15:15 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-10-30 17:15:15 +0100
commit17492c5f48c459dd44eafb0e747c1164193ca7f7 (patch)
tree5b6d699204e3da4aefe47d2344c29e7fcd877a75
parentf60beb6e45720ff44ba4e4db915f5e462fb3b907 (diff)
downloaddokka-17492c5f48c459dd44eafb0e747c1164193ca7f7.tar.gz
dokka-17492c5f48c459dd44eafb0e747c1164193ca7f7.tar.bz2
dokka-17492c5f48c459dd44eafb0e747c1164193ca7f7.zip
correctly working optional injection
-rw-r--r--src/Generation/FileGenerator.kt9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Generation/FileGenerator.kt b/src/Generation/FileGenerator.kt
index 08a885ab..c4025088 100644
--- a/src/Generation/FileGenerator.kt
+++ b/src/Generation/FileGenerator.kt
@@ -7,8 +7,9 @@ import java.io.IOException
import java.io.OutputStreamWriter
public class FileGenerator @Inject constructor(val locationService: FileLocationService,
- val formatService: FormatService,
- @Inject(optional = true) val outlineService: OutlineFormatService?) : Generator {
+ val formatService: FormatService) : Generator {
+
+ @set:Inject(optional = true) var outlineService: OutlineFormatService? = null
override fun buildPages(nodes: Iterable<DocumentationNode>) {
val specificLocationService = locationService.withExtension(formatService.extension)
@@ -30,9 +31,7 @@ public class FileGenerator @Inject constructor(val locationService: FileLocation
}
override fun buildOutlines(nodes: Iterable<DocumentationNode>) {
- if (outlineService == null) {
- return
- }
+ val outlineService = this.outlineService ?: return
for ((location, items) in nodes.groupBy { locationService.location(it) }) {
val file = outlineService.getOutlineFileName(location)
file.parentFile?.mkdirsOrFail()