diff options
Diffstat (limited to 'src/Kotlin/KotlinAsJavaDocumentationBuilder.kt')
-rw-r--r-- | src/Kotlin/KotlinAsJavaDocumentationBuilder.kt | 27 |
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)) + } + } +} |