Reputation: 27375
I have the following trait:
trait Tr
It's being contained in a module cdl-common
.
I want to detect all classes/objects extending it during compilation of the module cdl-impl
dependign on cdl-common
. For instance:
class Cls extends Tr
In Java, I could use annotation processor and annotate these classes with some annotation and then analyze AST.
Is it possible to do so in Scala
with macro without annotating the classes?
Upvotes: 1
Views: 683
Reputation: 6548
You can do this easily using ClassUtil .
For usage, you can refer the answer given here: Get all the classes that implments a trait in Scala using reflection
Upvotes: 1