aboutsummaryrefslogtreecommitdiff
path: root/src/Kotlin/KotlinAsJavaDocumentationBuilder.kt
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-10-30 18:43:48 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-10-30 18:43:48 +0100
commite4b2ae90bf0e84f76ceb7c56b7c128d28adad917 (patch)
treeb1e7d86b808b41909679d44da8ac97bec1928c44 /src/Kotlin/KotlinAsJavaDocumentationBuilder.kt
parent17492c5f48c459dd44eafb0e747c1164193ca7f7 (diff)
downloaddokka-e4b2ae90bf0e84f76ceb7c56b7c128d28adad917.tar.gz
dokka-e4b2ae90bf0e84f76ceb7c56b7c128d28adad917.tar.bz2
dokka-e4b2ae90bf0e84f76ceb7c56b7c128d28adad917.zip
initial support for generating javadoc from Kotlin light classes
Diffstat (limited to 'src/Kotlin/KotlinAsJavaDocumentationBuilder.kt')
-rw-r--r--src/Kotlin/KotlinAsJavaDocumentationBuilder.kt27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/Kotlin/KotlinAsJavaDocumentationBuilder.kt b/src/Kotlin/KotlinAsJavaDocumentationBuilder.kt
new file mode 100644
index 00000000..ae295769
--- /dev/null
+++ b/src/Kotlin/KotlinAsJavaDocumentationBuilder.kt
@@ -0,0 +1,27 @@
+package org.jetbrains.dokka
+
+import com.intellij.openapi.project.Project
+import com.intellij.psi.JavaPsiFacade
+import org.jetbrains.kotlin.asJava.KotlinLightElement
+import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
+import org.jetbrains.kotlin.name.FqName
+
+class KotlinAsJavaDocumentationBuilder() : PackageDocumentationBuilder {
+ override fun buildPackageDocumentation(project: Project,
+ packageName: FqName,
+ packageNode: DocumentationNode,
+ declarations: List<DeclarationDescriptor>,
+ options: DocumentationOptions,
+ refGraph: NodeReferenceGraph,
+ logger: DokkaLogger) {
+ val psiPackage = JavaPsiFacade.getInstance(project).findPackage(packageName.asString())
+ if (psiPackage == null) {
+ logger.error("Cannot find Java package by qualified name: ${packageName.asString()}")
+ return
+ }
+ val javaDocumentationBuilder = JavaDocumentationBuilder(options, refGraph)
+ psiPackage.classes.filter { it is KotlinLightElement<*, *> }.forEach {
+ javaDocumentationBuilder.appendClasses(packageNode, arrayOf(it))
+ }
+ }
+}