我最近在我的 Eclipse 中启动了我的 WebServicesExplorer,我刚刚意识到xs:element
JAXB 生成的名称并不那么冗长。这是序列之一:
<xs:sequence>
<xs:element minOccurs="0" name="arg0" type="xs:string" />
<xs:element minOccurs="0" name="arg1" type="xs:string" />
<xs:element name="arg2" type="xs:int" />
</xs:sequence>
从此文件生成:
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class User {
private String firstName;
private String lastName;
private int age;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
我还不是 JAXB 专家,所以我想知道是否可以将那些 arg* 命名元素更改为合理的东西,比如在 POJO 类中?