Imagine i have a macro annotation that annotates case class:
class message(`type`: String) extends StaticAnnotation {
def macroTransform(annottees: Any*) = macro message.impl
}
...
@message("SearchReq")
case class SearchReq(req: String)
I have MessageRegister object that located in another package. In annotation @message body message.impl
i need to add type of message in register.
I have no idea how to do that. The first thing that came to mind is get the tree of MessageRegister object and add code into its body that executes in runtime. The next idea is that somehow @message annotation executes in runtime and i simply execute MessageRegister.registerMessage(msg).
How can i solve this problem ?