Listing every objects that extends a trait

58 Views Asked by At

I would like to know how I can list every objects that extend a given trait.

For instance I have :

trait MyTrait

object MyTObjA extends MyTrait

object MyTObjB extends MyTrait

and what I want to achieve is something like that without having to list all these objects myself :

val myTraitObjects: Seq[Type] = Seq(typeOf[MyTObjA], typeOf[MyTObjB])
0

There are 0 best solutions below