jvmMain.GenerateDumper.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yass2-ksp-jvm Show documentation
Show all versions of yass2-ksp-jvm Show documentation
Yet Another Service Solution
package ch.softappeal.yass2.ksp
import com.google.devtools.ksp.symbol.*
internal fun Appendable.generateDumper(treeConcreteClasses: List, graphConcreteClasses: List) {
appendLine()
appendLine("public fun createDumper(dumpValue: kotlin.text.Appendable.(value: kotlin.Any) -> kotlin.Unit): $CSY.Dumper =")
appendLine(1, "$CSY.createDumper(")
appendLine(2, "$CSY.dumperProperties(")
(treeConcreteClasses + graphConcreteClasses).forEach { type ->
appendLine(3, "${type.qualifiedName()}::class to listOf(")
(type.declaration as KSClassDeclaration).getAllPropertiesNotThrowable().forEach { property ->
appendLine(4, "${type.qualifiedName()}::${property.simpleName()} as kotlin.reflect.KProperty1,")
}
appendLine(3, "),")
}
appendLine(2, "),")
appendLine(2, "setOf(")
graphConcreteClasses.forEach { type ->
appendLine(3, "${type.qualifiedName()}::class,")
}
appendLine(2, "),")
appendLine(2, "dumpValue,")
appendLine(1, ")")
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy