users@jaxb.java.net

Re: Inheritance and class callback methods

From: Levi Purvis <javanet_at_purvis.ws>
Date: Fri, 6 Oct 2006 14:11:59 -0400

> > If you have, say, readObject in the base class, does this method invoked
> > when you are processing derived types?
>
> No. But you can get that behavior by implementing Externalizable
> instead of Serializable. So it can work both ways.

Actually, let me clarify (I somehow misunderstood the question in my
haste). Yes. :-) readObject() is invoked for every class that
declares it in a hierarchy.

However, derived classes are not supposed to call a super.readObject()
to coordinate serialization (normally they can't anyway, because
readObject() is supposed to be private). Explicit coordination
between classes in a hierarchy is possible with Externalizable.