0
Realmオブジェクトの新しいキーを取得できる次のメソッドがあります。私は、パラメータとしてクラスを渡すことができるようにしたい:CapturedTypeConstructor(*)はRealmModelのサブタイプではありません
private fun getNextKeyForObject(myClass: Class<*>): Int {
mRealm?.let {
val maxId = it.where(myClass).max("id")
if (maxId != null) {
return it.where(myClass).max("id").toInt() + 1
}
}
return 0
}
私は次のエラーを取得する:
Type parameter bound for E in fun <E : RealmModel!> where(clazz: Class<E!>!): RealmQuery<E!>!
is not satisfied: inferred type CapturedTypeConstructor(*) is not a subtype of RealmModel!
感謝あなた、EpicPandaForce! –