jeudi 27 avril 2017

How to access case class field annotation values

I have a case class for which I add some annotation to some of the fields:

final class Anno(min: Int, max: Int) extends StaticAnnotation

case class Test(x: String, @Anno(min = 5, max = 10) y: String)

I would like to iterate each field of the case class, get its value and the case class annotation properties assigned to it (if annotation exists).

Any idea how can it be accomplished in Scala?





Aucun commentaire:

Enregistrer un commentaire