我用xjc做了一些类。JAXB - List <Serializable>?
public class MyType {
@XmlElementRefs({
@XmlElementRef(name = "MyInnerType", type = JAXBElement.class, required = false),
})
@XmlMixed
protected List<Serializable> content;
public List<Serializable> getContent() {
if (content == null) {
content = new ArrayList<Serializable>();
}
return this.content;
}
}
,但我不能使用
getContent().add(newItem);
因为MyInnerType无法序列化添加内部元件。 为什么它不是一个对象列表?我如何添加内部元素?
你得到什么错误? – Tudor 2012-01-31 14:50:58
MyInnerType不是可序列化的 – bunnyjesse112 2012-01-31 15:02:22