我有一些用 JAXB 注释映射的实体将它们转换为 xml,但是在这些实体 mxCell 中有一个对象,如何在代码库 JgraphX 中不添加注释的情况下映射该对象?
有我的 Objeto 类:
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@XmlSeeAlso({mxCell.class})
public abstract class ObjetoImpl implements Serializable, Objeto {
@XmlAttribute
protected String nome;
@XmlAnyElement
protected mxCell cell;
@Override
public String toString() {
return this.nome;
}
}
它给了我以下例外:
com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
com.mxgraph.model.mxICell is an interface, and JAXB can't handle interfaces.
this problem is related to the following location:
at com.mxgraph.model.mxICell
at public com.mxgraph.model.mxICell com.mxgraph.model.mxCell.getParent()
at com.mxgraph.model.mxCell
at @javax.xml.bind.annotation.XmlSeeAlso(value=[class com.mxgraph.model.mxCell])
at ardis.model.conceitual.atributo.Atributo
at protected java.util.List ardis.model.conceitual.ObjetoWithAttributeImpl.attributes
at ardis.model.conceitual.ObjetoWithAttributeImpl
at ardis.model.conceitual.entidade.Entidade
at @javax.xml.bind.annotation.XmlSeeAlso(value=[class ardis.model.conceitual.entidade.Entidade])
at ardis.model.conceitual.ModeloConceitual
当接口的实现未正确映射到 Jaxb 时会发生该异常,但我不想进入 jgraphx 库并对其进行修改