[Simple-support] How to annotate an attribute that is inherit from a parent class in the child clas
Brought to you by:
niallg
|
From: gato c. <da...@gm...> - 2011-03-03 16:05:02
|
I have the next structure:
class Element{
@Attribute(required = false)
int id;
setId(int id){
this.id=id;
}
public getId(){
return id;
}
}
class Edge extends Element{
@Element
Node to;
@Element
Node from;
//setters and getters for "to" and "from" attributes
}
class Node extends Element{
public Node(int id){
this.id=id;
}
}
How to annotate the attribute 'id' in order to get it as an @text element of
Node class, and also as a @Attribute of Edge class
What I need, is a way to unserialize the next xml, using the above
structure.
<Edge id="5"><to>214</to><from>235</from></edge>
The only thing solution I see , is to have a double annotation of id
attribute, one in the parent class and the other in child class. But I don't
know how to implementa that.
Any Suggestions are welcome.
Thanks for the help!
|