【发布时间】:2016-10-01 11:26:05
【问题描述】:
说,我有一个带注释的 Kotlin 类:
@Entity @Table(name="user") data class User (val id:Long, val name:String)
如何从@Table注解中获取name属性的值?
fun <T> tableName(c: KClass<T>):String {
// i can get the @Table annotation like this:
val t = c.annotations.find { it.annotationClass == Table::class }
// but how can i get the value of "name" attribute from t?
}
【问题讨论】:
标签: annotations kotlin