【发布时间】:2016-05-27 14:48:20
【问题描述】:
为了更深入地了解 Scala,我使用了 mysql 包装器。没有生产的东西,只是试验。
我有一个指定抽象方法的特征:
trait EntityDefinition {
def tableName: String
}
然后我有一个参数化类,我想在其中访问 tableName:
class FinagleRepository[T >: EntityDefinition] @Inject()(client: FinagleMysqlClient) {
def create(entity: T): Future[Result] = {
// Here it is impossible to call T.tableName
}
}
谁能告诉我我做错了什么?
【问题讨论】: