我正在为来自xsd模式的JAXB注释类使用XJC实用程序,我有点惊讶并且不明白为什么会生成@XmlElementRefs。一切都发生在以下xsd片段中(此处省略命名空间)List<Employee>List<Manager>List<TimeStamp>xjc生成的java类如下:packagecom.pif.check;importjava.util.ArrayList;importjava.util.List;importjavax.xml.bind.JAXBElement;importjavax.xml.bind.annotation.XmlA
我有4个类(class)。Person类,以及抽象的ContactInformation,Phone和Address类对其进行扩展。@XmlRootElement@XmlAccessorType(XmlAccessType.NONE)publicclassPerson{@XmlElement(required=true,nillable=false)privateStringfirst;@XmlElement(required=true,nillable=false)privateStringlast;@XmlElementWrapper(name="contacts")@XmlEle
有人可以给我解释一下吗@XmlElementRefs和@XmlElementRef注解在Java中的含义及其用途..EDIT:@skaffman好吧,假设我有一个这样的Collection@XmlElementRefs({@XmlElementRef(name="ElementA",type=ClassA),@XmlElementRef(name="ElementB",type=ClassB)})Listitems;现在如何访问此列表的每个单独元素?以下代码是否正确?for(intj=0;j这是正确的方法吗?有没有更好的方法来执行每个类的特定处理?我的意思是有没有办法避免那些ifels