[quoted text, click to view] > Java class which will be serialized from j# or deserialized by j# have to
contain DECLARED and PUBLIC constructor without any parameters. It's not
problem,
[quoted text, click to view] > most likely it's just inconvenience.
isn't that the case with Sun Java too?
or do you find that just j# need the default public constructor available at
the class to have it deserialized?
at the Sun JVM side, maybe the "Proxy" class can help with such things, or
else maybe JNI has some useful call
btw, the idea is that you shouldn't be able to trick the JVM to instantiate
an object (make a class instance) for a class that has no default public
constructor, or has a private default constructor (for example it might have
a "private" default constructor to force all descendent classes not be
instantiatable too! [if it had "protected" or no default constructor a
descendent class could add a "public" constructor])
if you're interested to support Double, Long, etc. classes hardcode their
marshalling/unmarshalling instead or even better make a lookup hash, where
one passes a fully qualified class name (like "java.lang.Double") and gets
back a marshaller/unmarshaller class interface implementation (that takes an
"Object" [instance of the wanted class] and writes it to a stream [or
vice-versa])
e.g.
public interface Marshaller {
public void marshal(Object x, SomeOutputStream s);
}
public interface Unmarshaller {
public Object unmarshal(SomeInputStream s);
}
public class DoubleMarshallingSupport
implements Marshaller, Unmarshaller
{
public void marshal(Object x, SomeOutputStream s){
s.writedouble(Double.doubleValue());
}
public Object unmarshal(SomeInputStream s){
return new Double(s.readdouble());
}
}
or something like that
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
George Birbilis <birbilis@kagi.com> [J# MVP9880]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ QuickTime VCL and ActiveX controls (for PowerPoint/VB/Delphi etc.)
+ Plugs VCL and ActiveX controls (InterProcess/Internet communication)
+ TransFormations, VB6 forms to ASP.net WebForms convertion
http://www.kagi.com/birbilis + Robotics
http://www.mech.upatras.gr/~robgroup
.........................................................................