我有一些课程:
public class Human{
private String lastName;
private String firstName;
private String patronymic;
private String dateOfBirth;
//..
}
我想把这个课程编成一些xml:
<human>
<fio>
<lastname></lastname>
<firstname></firstname>
<patronymic></patronymic>
</fio>
<dateOfBirth><dateOfBirth>
</human>
使用什么注释创建伪容器字段?
答案 0 :(得分:1)
您可以查看xml元素包装器:
http://kodejava.org/how-to-generate-a-wrapper-element-around-xml-representation-in-jaxb/
但我认为你的情况必须与:
public class Human{
private Object Fio;
private String dateOfBirth;
//..
}
public class Fio{
private String lastName;
private String firstName;
private String patronymic;
}