当我想用 Xmappr 注释为 java 类中的 XML 元素指定属性时,我使用 @Attribute 注释,例如:
示例类.java:
@Attribute("Code")
private String code;
它正在映射品牌元素的属性代码
品牌.xml:
<Brand Code="123">
<Description>Name</Description>
<BrandName>true</BrandName>
</Brand>
我的任务是将 Xmappr 注释更改为 BeanIO。
我可以使用 @Field 注释映射的单个元素(无属性),例如:
@Field(xmlName="Description")
Private String description;
那么问题来了,如何使用 BeanIO将属性Code获取到 java 类?我需要将xml更改为:
<Brand>
<BrandCode>123</BrandCode>
<Description>Name</Description>
<BrandName>true</BrandName>
</Brand>
而不是在Code上使用 @Field 注释,还是有其他方法可以做到这一点?