All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jvmMain.GenerateDumper.kt Maven / Gradle / Ivy

There is a newer version: 15.0.5
Show newest version
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