users@jaxb.java.net

Re: XJC Plugin development question

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 13 Mar 2006 12:20:18 -0800

Gertelman, Michael, VF-JP wrote:
> Hello,
>
> I'm trying to inject some code into the ObjectFactory from the impl package.
> I use the following code in my Plugin's run method:
>
> for (PackageOutline po : outline.getAllPackageContexts()) {
> JDefinedClass objectFactory = po.objectFactory();
> }
>
> Actually, Iterator always returns only one PackageOutline - for the interfaces package. My problem is that this objectFactory refers to the class in the interfaces package.
> If I inject any code into this objectFactory it affects only the one from the interfaces package.
>
> How can I access the ObjectFactory class from the implementation package ?

As Malachi pointed out the iterator is meant for different packages, and
not for interface/impl split.

For Malachi, the reason he's getting two ObjectFactories is because he
chose not to generate value classes (but intf/impl pairs.)


This actually led me to find a bug in the code, so now this same method
actually returns a private ObjectFactory (in the impl class.)

Allowing you to access both is bit tricky. Would this change get you
going? (IOW, do you need to access both ObjectFactories, or just the one
in the impl package?)

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com