I’m trying to do something like this:
trait BaseMongoDAO[T <: IdentifiableModel with CaseClass] {
implicit val manifest: Manifest[T]
........ some implicit manifest usage here
}
trait MongoUserRepository extends BaseMongoDAO[User] with UserRepository {
override val manifest = Manifest.classType(User.getClass)
........ implementing UserRepository here
}
But it doesn’t seem to work and it says my Manifest is of incompatible type.
I did something wrong?
If we look at the definition of
classType:We can see that
Tis not inferred from the argument, and thus can only be inferred from the return type, or by explicitly giving the type parameter. The following should fix your issue:Alternatively: