I am trying to use custom annotation in Scala. In this example, I am creating a row that I want to annotate with metadata (in this case, another row). Then, given the data instance, and I want to read the annotation.
scala> case class named(name: String) extends scala.annotation.StaticAnnotation defined class named scala> @named("Greeting") val v = "Hello" v: String = Hello scala> def valueToName(x: String): String = ??? valueToName: (x: String)String scala> valueToName(v)
Is it possible?
source share