users@jaxb.java.net

Re: Generating bound javabeans using xjc

From: Kohsuke Kawaguchi <kohsuke.kawaguchi_at_sun.com>
Date: Fri, 21 Oct 2005 11:45:07 -0700

Sorry for a delay.

Dmitri Colebatch wrote:
> Hi,
>
> I'd like to generate beans that have PropertyChangeListener support,
> that is have addPropertyChangeListener(PropertyChangeListener
> pcl)/removePropertyChangeListener(PropertyChangeListener pcl) methods.
>
> I'm looking through the source to ImplStructureStrategy which seems to
> be what I need to be hooking into, but I don't see how I can get in to
> fire PropertyChangeEvents.
>
> Surely I'm not the first person to have this requirement? Does anyone
> have any guidance on how to hook into this area?

For plugins to do this, I think I need to open up more of the code
generation process to plugins, for example so that you can inject code
into the setter method. This is also useful for other purposes, such as
injecting code to check the int value against facets, etc.

I'll see what I can do. You are welcome to file an issue to track the
progress of this.

Regarding your PropertyChangeListener, it would be somewhat difficult to
fire an event for a change to List, as it happens outside the knowledge
of JAXB.

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com