Hi,
I've got some stuff that looks like:
interface I {
}
class A implements I {
}
class B implements I {
}
I'd like to be able to have a file containing an I, and then load it
in without having to know if it is an A or a B.
Currently if I serialise an A, I get
<a> ... </a>
If I try:
persister.read( I.class, file )
it says it cannon instantiate I
However, if I manually change the xml to be:
<i class="A">...</i>
Then it works happily.
This seems very much like the behaviour for collections. Is there any
way to specify this for single objects? i.e. to ask that when it is
serialised, it is as the interface, with the class appended?
I realise on thinking about it that it's probably often bad design to
put this in the class (especially if it could implement several
interfaces etc.). But is there a way to ask the persister to serialise
based on a certain interface?
Thanks,
dave
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
------------------------------------------------------------------------------
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