diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-02-16 14:02:10 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-02-16 14:02:10 +0100 |
commit | 6d5d88b88039799f19ecc4be74deb6a775bb462d (patch) | |
tree | ff994a998fae0143fe90f2aa22a94a6788218826 /src | |
parent | 15e95f16eccbc3667ee86fc7ed78533f84e67ddd (diff) | |
download | dokka-6d5d88b88039799f19ecc4be74deb6a775bb462d.tar.gz dokka-6d5d88b88039799f19ecc4be74deb6a775bb462d.tar.bz2 dokka-6d5d88b88039799f19ecc4be74deb6a775bb462d.zip |
represent fields as Kotlin properties
Diffstat (limited to 'src')
-rw-r--r-- | src/Java/JavaDocumentationBuilder.kt | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/Java/JavaDocumentationBuilder.kt b/src/Java/JavaDocumentationBuilder.kt index 0a9632bf..d57ffb0c 100644 --- a/src/Java/JavaDocumentationBuilder.kt +++ b/src/Java/JavaDocumentationBuilder.kt @@ -18,7 +18,7 @@ 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 +import com.intellij.psi.PsiField public class JavaDocumentationBuilder(private val options: DocumentationOptions) { fun appendFile(file: PsiJavaFile, module: DocumentationModule) { @@ -94,10 +94,21 @@ public class JavaDocumentationBuilder(private val options: DocumentationOptions) getImplementsListTypes().forEach { node.appendType(it, Kind.Supertype) } node.appendDetails(getTypeParameters()) { build() } node.appendMembers(getMethods()) { build() } + node.appendMembers(getFields()) { build() } node.appendMembers(getInnerClasses()) { build() } return node } + fun PsiField.build(): DocumentationNode { + val node = DocumentationNode(this, + if (hasModifierProperty(PsiModifier.STATIC)) DocumentationNode.Kind.ClassObjectProperty else DocumentationNode.Kind.Property) + if (!hasModifierProperty(PsiModifier.FINAL)) { + node.append(DocumentationNode("var", Content.Empty, Kind.Modifier), DocumentationReference.Kind.Detail) + } + node.appendType(getType()) + return node + } + fun PsiMethod.build(): DocumentationNode { val node = DocumentationNode(this, if (isConstructor()) Kind.Constructor else Kind.Function, |