我有一个真正的初学者使用的问题阶的元使用阶的元注释的情况下,类
我要添加注解基础上,该字段的名称的情况下,类的字段的子集。 的类和字段批注定义如下:
val classMapping = Map[String,String](
("com.example.employees","""OntologyContext("http://schema.org")"""),
("Employee.scala","""OntologyType("person")""")
)
val fieldMapping = Map[String,String](
("hello","""OntologyRef("name")"""),
("job","""OntologyRef("title")"""),("id","""Obfuscated""")
)
前:
package com.example.employees
import java.time.LocalDate
case class Employee(
hello: String,
job:String,
id:String,
employmentDate: Date)
后:
package com.example.employees
import java.time.LocalDate
@OntologyContext(“http://schema.org”)
@OntologyType(“person”)
case class Employee(
@OntologyRef(“name”) hello: String,
@OntologyRef(“title”) job: String,
@Obfuscated() id:String,
employmentDate: Date
)
我的问题涉及到需要在quasiquotes的语法树的变换:
- 选择指定字段;和
- 插入注释
你可以参考我可以指出我在正确的方向上没有任何的例子吗?