I am using a Generic Mapper to map a Model from a DBModel in scala 2.11
it has a method defined as:
def fromModelToDBModel(m: T) : R
where T is the type of the Model and R is the type of the DBModel.
This method is implemented the same way in almost all inheriting objects, ie:
override def fromModelToDBModel(p: RawModel): RawDBModelV1 = {
val values = RawModel.unapply(p).get
val makeDBModel = (RawDBModelV1.apply _).tupled
makeDBModel(values)
}
Is it possible to somehow define a generic object in the base Trait, so I can call apply/unapply on it?
Aucun commentaire:
Enregistrer un commentaire