aboutsummaryrefslogtreecommitdiff
path: root/src/Java/JavaDocumentationBuilder.kt
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/Java/JavaDocumentationBuilder.kt
parent6c93cc98e52c2096ebd8197a3f2d1201f0a5bedc (diff)
downloaddokka-15e95f16eccbc3667ee86fc7ed78533f84e67ddd.tar.gz
dokka-15e95f16eccbc3667ee86fc7ed78533f84e67ddd.tar.bz2
dokka-15e95f16eccbc3667ee86fc7ed78533f84e67ddd.zip
exclude private members
Diffstat (limited to 'src/Java/JavaDocumentationBuilder.kt')
-rw-r--r--src/Java/JavaDocumentationBuilder.kt10
1 files changed, 8 insertions, 2 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)