Kotlin Reflection
Reflection
Reflection is a set of language and library features that allows for introspecting the structure of your own program at runtime
Reflection is distributed as a seperate artifact
On the JVM platform, the runtime component required for using the reflection features is distributed as a separate artifact kotlin-reflect.jar in the Kotlin compiler distribution. This is done to reduce the required size of the runtime library for applications that do not use reflection features.
How to use reflection in Gradle
Add the dependency on
kotlin-reflect
dependencies {
implementation("org.jetbrains.kotlin:kotlin-reflect:1.4.10")
}
Class references reflection
The most basic reflection feature is getting thre runtime reference to a kotlin class
val c = MyClass::class
The reference is a value of type KClass ..java
property on a KClass val c = MyClass::class.java
Links
Reflection
Reference
이 문제에 관하여(Kotlin Reflection), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://zenn.dev/aa/articles/36fc929244765fb35635텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)