aboutsummaryrefslogtreecommitdiff
path: root/javadoc/src/main/kotlin/source-position.kt
diff options
context:
space:
mode:
authorSergey Mashkov <sergey.mashkov@jetbrains.com>2015-07-28 14:15:55 +0300
committerSergey Mashkov <sergey.mashkov@jetbrains.com>2015-07-28 14:15:55 +0300
commit12f91ee7d491b21359ff8e8822c594f35b904def (patch)
treeb7dea76ce8b3d6a99f037917e7fd1abff43b0bbc /javadoc/src/main/kotlin/source-position.kt
parent87edf7c5778a9e1ac3e17c9046110d69e8d197a6 (diff)
downloaddokka-12f91ee7d491b21359ff8e8822c594f35b904def.tar.gz
dokka-12f91ee7d491b21359ff8e8822c594f35b904def.tar.bz2
dokka-12f91ee7d491b21359ff8e8822c594f35b904def.zip
Initial javadoc generation module
Diffstat (limited to 'javadoc/src/main/kotlin/source-position.kt')
-rw-r--r--javadoc/src/main/kotlin/source-position.kt18
1 files changed, 18 insertions, 0 deletions
diff --git a/javadoc/src/main/kotlin/source-position.kt b/javadoc/src/main/kotlin/source-position.kt
new file mode 100644
index 00000000..0e4c6e3c
--- /dev/null
+++ b/javadoc/src/main/kotlin/source-position.kt
@@ -0,0 +1,18 @@
+package org.jetbrains.dokka.javadoc
+
+import com.sun.javadoc.SourcePosition
+import org.jetbrains.dokka.DocumentationNode
+import java.io.File
+
+class SourcePositionAdapter(val docNode: DocumentationNode) : SourcePosition {
+
+ private val sourcePositionParts: List<String> by lazy {
+ docNode.details(DocumentationNode.Kind.SourcePosition).firstOrNull()?.name?.split(":") ?: emptyList()
+ }
+
+ override fun file(): File? = if (sourcePositionParts.isEmpty()) null else File(sourcePositionParts[0])
+
+ override fun line(): Int = sourcePositionParts.getOrNull(1)?.toInt() ?: -1
+
+ override fun column(): Int = sourcePositionParts.getOrNull(2)?.toInt() ?: -1
+}