I want to map multiple types in a model class, which is being referred from controller and repository class.
For Example :
case class ManagedService(
...some parameters,
attributes: Seq[Attribute],
...etc
) extends RelatedResource {
override def resourceId = name
override def resourceType = "instance"
}
trait RelatedResource {
def resourceId: Option[String]
def resourceType: String
}
Now, if I want to add override def resourceType = "memory"
and
override def resourceType = "readers"
along with instance, how can I
add them? This is to execute the URL with www.example.com/type=memory
.
You can just override the trait's methods as constructor val's in your case class as below:
case class ManagedService(
...some parameters,
resourceId: Option[String],
resourceType: String
attributes: Seq[Attribute],
...etc
) extends RelatedResource