xmlencoder/decoder persistence delegate

S

slightlykirix

Hi,
I am using the xmlencoder/decoder classes to save objects, some of
which do not have no-argument constructors. I understand that one could
use something like:

String[] prop = {"param1", "param2"};
MyEncoder.setPersistenceDelegate(MyClass.class
new DefaultPersistenceDelegate(prop);

My question is, what if one has a class like:
class A{
-----
B objB = new B(C c, D d);
-----
}

class B{
-----
E objE = new E(F f, G g);
-----
}

I need to save an object of A that contains an object of B that does
not have a default constructor and B in turn needs to store an object
of E which again does not have a default constructor. Assuming that all
attributes of all classes that need to be saved do have the required
setter and getter methods, I couldn't find a way to save all those
objects because I can set the persistence delegate for only one class.
Is it possible to save all the objects?
TIA.
--Jo
 
S

slightlykirix

the XMLEncoder/Decoder requires that the default constructor has public
access because that is what is called by the XMLDecoder when decoding
the xml data.
--Jo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top