5
を取得する方法は、私が注釈で1つのKotlinクラスを持っている、と言う: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?
}
は 'find'は、うん' firstOrNull'、ない 'first' – Ilya
のと同等である私の心に、それは一時的に後ろ向きだった、ただそれを心配ない答えを簡素化。 –