My annotation looks like:
class extract(val name: String) extends StaticAnnotationAnd I'm using it like this:
case class MainClass(@extract("strings") foo: String, bar: Int)I'm trying to get the foo parameter Symbol because it has an @extract annotation (I also want to do something with the extract value):
val extrList = params.map { param: Symbol =>
param.annotations.collect {
case extr if extr.tpe <:< c.weakTypeOf[extract] =>
val args = extr.scalaArgs
if (args.size != 1)
abort("@extract() should have exactly 1 parameter")
getExtractValue(args.head) -> param
}
}The signature of the getExtractValue method looks like this:
def getExtractValue(tree: Tree): String = ???How do I get the value the @extract annotation object