interface Marker<T : BaseFoo> {
fun getSpecialFoo(): List<T>
}
@Dao
interface FooDao: Marker<Foo> {
@Query("SELECT * FROM foo WHERE bar = :bar")
fun get(bar: Int): List<Foo>
@Transaction
override fun getSpecialFoo(): List<Foo> {
return get(1)
}
}
这导致
抽象DAO方法必须使用以下注释之一进行注释:插入、删除、查询、更新和查询
However, Marker
is not marked with @Dao
and FooDao
override getSpecialFoo
already. Why does this error still show?
我需要Marker
个,因为我需要一个具有一些方法的泛型DAO.有什么办法可以解决这个问题吗?
我能想到的唯一方法是将dao标记为Any
,并转换类型runtime或为dao构建包装器.