I have some entities mapped with JAXB annotations to turn them into xml, but within those entities mxCell there is an object, how can I map this object without adding annotations in the code library JgraphX?
There is my Objeto class:
@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;
}
}
It's give me the following exception:
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
That exception occurs when the implementation of the interface is not correctly mapped with Jaxb, but i don't want enter into the jgraphx library and modify it
I could not convert the objects of the program who had a mxCell inside using JAXB, so the solution for me was use the JgraphX "getXml" to convert the graph elements and the values of each cell. After that I get the value of the cells and use at my code.
The code to pass the graph to xml: