dev@jaxb.java.net

Life-cycle events (was Re: Complex references)

From: Ryan Shoemaker - JavaSoft East <Ryan.Shoemaker_at_Sun.COM>
Date: Wed, 13 Jul 2005 17:54:55 -0400

Joe Fialli wrote:
> Kohsuke Kawaguchi wrote:
>>
>> 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.)
>
>
> The public draft of the JAXB 2.0 specification[1] documents the
> unmarshal and marshal callback events in Section
> 4.4.1 and 4.5.1. The JAXB mapped class will not have to implement the
> ObjectLifeCycle interface,
> it just has to define the precise method signatures defined in the
> specification. As Kohsuke mentioned,
> the RI originally prototyped this functionality and thus the RI and spec
> are not synchronized on this functionality yet
> but will be in future.
>

Kohsuke,

So, we are going to get rid of c.s.x.b.ObjectLifyCycle and rely on
reflection to detect the existence of the life-cycle methods? Or
are we going to generate empty methods and always invoke them? Using
reflection during un/marshal doesn't seem like a wise approach. We'd
have to perform a look-up per bean type, right? Generating a skeleton
method that we always invoke might complicate the "merging user code"
issue, but at least it would be obvious to the developers that the
life-cycle hooks exist.

Joe mentioned that you guys had a conversation about this today - I'm
looking for more info on your perspective of how this is going to work.

It looks like the current call-backs for unmarshalling are happening
in the UnmarshallingContext. How much is this going to change when we
switch to a reflection based approach? Do you foresee any impact from
re-implementing the unmarshaller? Where will the life-cycle events be
triggered on the marshalling side? We also need to figure out a way
to register life-cycle callback objects for people that want the logic
outside of the bean. It seems like that may severely limit the kind of
pre/post processing you can do on the bean, but Joe mentioned that it
was a requirement from one of the EG members. I'm not quite sure how
the registration mechanism is going to work - that will need to be
specified somehow. Sounds like there are going to be new methods on
Un/Marshaller to register call-back objects that have the life-cycle
methods.

Thanks,

--Ryan