将字段从具有特定注释的entities类映射到Java中的其他POJO字段
我们定义了数据库中的实体,为了表示多语言属性,我们在几个实体字段上添加了注释。现在,我们在这些实体的基础上构建了几个API,它们有自己的pojo。 例如: 如果客户是实体类将字段从具有特定注释的entities类映射到Java中的其他POJO字段,java,pojo,entities,dropwizard-guice,Java,Pojo,Entities,Dropwizard Guice,我们定义了数据库中的实体,为了表示多语言属性,我们在几个实体字段上添加了注释。现在,我们在这些实体的基础上构建了几个API,它们有自己的pojo。 例如: 如果客户是实体类 class Customer{ String customerId; @Multilingual String firstName; String lastName; //other fields }* 现在,我们有几个get API,它们将结果返回到我们的UI,例如:fetchCustome
class Customer{
String customerId;
@Multilingual
String firstName;
String lastName;
//other fields
}*
现在,我们有几个get API,它们将结果返回到我们的UI,例如:fetchCustomerDetails API
CustomerResponse{
List[] Customers;
//other fields
List[]orders;
}
现在,当它收到一个调用时,我们从db获取数据并准备CustomerResponse。
现在我还想发出带有响应的元数据
{
"multilingualSupport": {
"customer": [
"firstname"
]
}
}
现在,我如何将实体注释字段映射到CustomerResponse并在API响应中添加元数据