Re: [Simple-support] How to annotate an attribute that is inherit from a parent class in the child
Brought to you by:
niallg
|
From: Alexander S. <ir...@gm...> - 2011-03-03 16:18:03
|
Override it in both classes
С уважением, Александр Щеголев.
03.03.2011, в 19:04, gato chlr <da...@gm...> написал(а):
> 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!
>
> ------------------------------------------------------------------------------
> Free Software Download: Index, Search & Analyze Logs and other IT data in
> Real-Time with Splunk. Collect, index and harness all the fast moving IT data
> generated by your applications, servers and devices whether physical, virtual
> or in the cloud. Deliver compliance at lower cost and gain new business
> insights. http://p.sf.net/sfu/splunk-dev2dev
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
|