aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-02-16 13:40:43 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-02-16 13:40:43 +0100
commit15e95f16eccbc3667ee86fc7ed78533f84e67ddd (patch)
tree4b5b9d3a2692db1971f9eb561118220e35c5bfc7 /src
parent6c93cc98e52c2096ebd8197a3f2d1201f0a5bedc (diff)
downloaddokka-15e95f16eccbc3667ee86fc7ed78533f84e67ddd.tar.gz
dokka-15e95f16eccbc3667ee86fc7ed78533f84e67ddd.tar.bz2
dokka-15e95f16eccbc3667ee86fc7ed78533f84e67ddd.zip
exclude private members
Diffstat (limited to 'src')
-rw-r--r--src/Java/JavaDocumentationBuilder.kt10
-rw-r--r--src/main.kt2
2 files changed, 9 insertions, 3 deletions
diff --git a/src/Java/JavaDocumentationBuilder.kt b/src/Java/JavaDocumentationBuilder.kt
index 9770fc95..0a9632bf 100644
--- a/src/Java/JavaDocumentationBuilder.kt
+++ b/src/Java/JavaDocumentationBuilder.kt
@@ -18,8 +18,9 @@ import com.intellij.psi.PsiTypeParameter
import com.intellij.psi.javadoc.PsiDocTag
import com.intellij.psi.javadoc.PsiDocTagValue
import com.intellij.psi.PsiEllipsisType
+import com.intellij.psi.PsiElement
-public class JavaDocumentationBuilder() {
+public class JavaDocumentationBuilder(private val options: DocumentationOptions) {
fun appendFile(file: PsiJavaFile, module: DocumentationModule) {
val packageNode = module.findOrCreatePackageNode(file.getPackageName())
packageNode.appendChildren(file.getClasses()) { build() }
@@ -66,10 +67,15 @@ public class JavaDocumentationBuilder() {
kind: DocumentationReference.Kind = DocumentationReference.Kind.Member,
buildFn: T.() -> DocumentationNode) {
elements.forEach {
- append(it.buildFn(), kind)
+ if (!skipElement(it)) {
+ append(it.buildFn(), kind)
+ }
}
}
+ private fun skipElement(element: Any): Boolean =
+ !options.includeNonPublic && element is PsiModifierListOwner && element.hasModifierProperty(PsiModifier.PRIVATE)
+
fun DocumentationNode.appendMembers<T>(elements: Array<T>, buildFn: T.() -> DocumentationNode) =
appendChildren(elements, DocumentationReference.Kind.Member, buildFn)
diff --git a/src/main.kt b/src/main.kt
index c422b9f6..63495d46 100644
--- a/src/main.kt
+++ b/src/main.kt
@@ -215,7 +215,7 @@ fun buildDocumentationModule(environment: AnalysisEnvironment,
}
val javaFiles = environment.getJavaSourceFiles().filter(filesToDocumentFilter)
- val javaDocumentationBuilder = JavaDocumentationBuilder()
+ val javaDocumentationBuilder = JavaDocumentationBuilder(options)
javaFiles.map { javaDocumentationBuilder.appendFile(it, documentationModule) }
documentationModule