users@jaxb.java.net

Re: Complex references

From: Jeremy Haile <jhaile_at_fastmail.fm>
Date: Fri, 15 Jul 2005 08:49:36 -0400

If I understand it correctly, on order to receive object lifecycle
events, the object that is being bound to XML must implement
ObjectLifecycleListener. What I don't like about this is that it forces
the developer to introduce a coupling between the JAXB classes and the
mapped object. Although I don't have a problem with this listener
interface being part of the spec, I think it would be useful to have a
listener interface that can be implemented by any class interested in
object lifecycle events.

For example, the way Castor currently works is that there is a
MarshallListener and an UnmarshallListener interface that can be
registered with the Marshaller or Unmarshaller. Any class can implement
this and then receives lifecycle events for every object that is
marshalled or unmarshalled. This way, your XML-mapped classes do not
have to be coupled by implementing JAXB interfaces.

Jeremy Haile


On Tue, 12 Jul 2005 17:31:02 -0700, "Kohsuke Kawaguchi"
<Kohsuke.Kawaguchi_at_Sun.COM> said:
> Dmitri Colebatch wrote:
> > thanks - but this is part of the spec right? why isn't it in the jaxb
> > package? not that I have anything against the RI, but shouldn't we be
> > writing our code so that we can change implementation without changing
> > the code?
>
> I think we are planning to move the functionality into the spec, but our
> current thinking is to make it not an interface (so that you can
> selectively implement it, so that you don't have to make those methods
> public, etc.)
>
> Sometimes we do experiments within the RI before moving that up to the
> spec, and this is one such instance.
>
> --
> Kohsuke Kawaguchi
> Sun Microsystems kohsuke.kawaguchi_at_sun.com