Is there a way to identify a Kotlin data class from a regular Kotlin class? Like using reflection maybe?
相关问题
- C# how to invoke a field initializer using reflect
- Does powershell have a method_missing()?
- How to refresh height of a Constrained View in Con
- Android Room Fetch data with dynamic table name
- Access Binding Adapters in multi module project
相关文章
- Are GetCallingAssembly() and GetExecutingAssembly(
- SonarQube: How to suppress a warning in Kotlin cod
- What are the `^let` annotations in Android Studio
- Why doesn't reflections.getSubTypesOf(Object.c
- Create Custom Dagger 2 Scope with Kotlin
- Load a .NET assembly from the application's re
- Android Studio 3.5 ERROR: Unable to resolve depend
- Get list of classes in namespace in C# [duplicate]
Since 1.1 there is an isData property on the class
You can't read
data
annotation by reflection because it has default retention(CLASS
).You can try to use some heuristics, like check that it contains next methods:
public final copy
public final component{N}
public static copy$default
But note that somethings of this are implementation details and may be changed in the future.