Search code examples
reflectionmetaprogrammingkotlindata-class

Is there a way to identify a Kotlin data class from a regular Kotlin class?


Is there a way to identify a Kotlin data class from a regular Kotlin class? Like using reflection maybe?


Solution

  • Since 1.1 there is an isData property on the class

    MyDataClass::class.isData