코틀린(Kotlin, Java)
get Data class Field value by Reflect
1. implementation "org.jetbrains.kotlin:kotlin-reflect" 위의 디펜던시를 임플리멘트합니다. 2. package functions.technique import kotlin.reflect.full.memberProperties // implementation ("org.jetbrains.kotlin:kotlin-reflect") 임플리멘트 후 출력 class User(val age: Int, val name: String, val location : String) fun main() { val user = User(36, "Yoon", "korea") for (prop in User::class.memberProperties) { println("${prop.na..
2022. 5. 22. 21:33