diff options
Diffstat (limited to 'src/Java/JavaDocumentationBuilder.kt')
-rw-r--r-- | src/Java/JavaDocumentationBuilder.kt | 10 |
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) |