|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Support for polymorphism/inheritanceI read with interest the following message in the archive: I am encountering a similar issue and wondered if there was a task on the Simple XML roadmap to tackle polymorphism/inheritance. Simply put: i) Say you have a parent class or interface called Task ii) You have two classes ThisTask and ThatTask that either extent the class or implement the interface iii) In another class I have a ListofTasks which is a List<Task>, and that list can (of course) contain any number of ThisTask's and ThatTask's in any order (not too bothered about the order, as I understand XML parsers cannot guarantee node ordering) What I'd LIKE to see in the XML when serialised is something like: <ListofTasks> <ThisTask/> <ThatTask/> <ThisTask/> <ThisTask/> <ThatTask/> <ThatTask/> <ThatTask/> </ListofTasks> What I actually get is <ListofTasks> <Task class="ThisTask"/> <Task class="ThatTask"/> <Task class="ThisTask"/> <Task class="ThisTask"/> <Task class="ThatTask"/> <Task class="ThatTask"/> <Task class="ThatTask"/> </ListofTasks> Since I'm working from the XML as a master (the actual XML is more complicated than this, but I've simplified to illustrate the issue), I currently have no choice but to change the structure of the top-level class, so instead of: List<Task> tasks = ArrayList<Task>(); I have to have a member variable for each type of task: List<ThisTask> thisTasks = ArrayList<ThisTask>(); List<ThatTask> thatTasks = ArrayList<ThatTask>(); so I when I deserialise and then serialise the XML is the same. I saw a reply from Niall mentioning how this could be resolved. Is this on the roadmap and is there a timeline?
Regards,
Andy Barlow The information in this email or facsimile is confidential and is intended solely for the addressee(s) and access to this email or facsimile by anyone else is unauthorised. If you are not the intended recipient then any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. Information expressed in this email or facsimile is not given or endorsed by my firm or employer unless otherwise indicated by an authorised representative independent of this message.
------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Simple-support mailing list Simple-support@... https://lists.sourceforge.net/lists/listinfo/simple-support |
|||||||||||||||||||||||||
|
|
Re: Support for polymorphism/inheritance
------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Simple-support mailing list Simple-support@... https://lists.sourceforge.net/lists/listinfo/simple-support |
| Free embeddable forum powered by Nabble | Forum Help |