• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download

<lambda>null1 package com.android.codegen
2 
3 import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration
4 import com.github.javaparser.ast.body.TypeDeclaration
5 
6 open class ClassInfo(val classAst: ClassOrInterfaceDeclaration, val fileInfo: FileInfo) {
7 
8     val fileAst = fileInfo.fileAst
9 
10     val nestedClasses = classAst.members.filterIsInstance<ClassOrInterfaceDeclaration>()
11     val nestedTypes = classAst.members.filterIsInstance<TypeDeclaration<*>>()
12 
13     val superInterfaces = classAst.implementedTypes.map { it.asString() }
14     val superClass = classAst.extendedTypes.getOrNull(0)
15 
16     val ClassName = classAst.nameAsString
17     private val genericArgsAst = classAst.typeParameters
18     val genericArgs = if (genericArgsAst.isEmpty()) "" else {
19         genericArgsAst.map { it.nameAsString }.joinToString(", ").let { "<$it>" }
20     }
21     val ClassType = ClassName + genericArgs
22 
23     val constDefs = mutableListOf<ConstDef>()
24 
25     val fields = classAst.fields
26             .filterNot { it.isTransient || it.isStatic }
27             .mapIndexed { i, node -> FieldInfo(index = i, fieldAst = node, classInfo = this) }
28             .apply { lastOrNull()?.isLast = true }
29 }