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
Roedy Green - 11 Oct 2005 23:10 GMT
>which do not have no-argument constructors.
Why not give them private no-arg constructors?

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
slightlykirix - 12 Oct 2005 17:40 GMT
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