users@jaxb.java.net

RE: Re: Subclassing JAXB 2.0-generated classes

From: Pelenur, Matias <pelenur_at_amazon.com>
Date: Wed, 12 Jul 2006 16:48:16 -0700

I see. Is there a way then to annotate the original XSD so that the generated classes put the annotation on the method instead of the field?

Thanks,
Matias

> -----Original Message-----
> From: Kohsuke Kawaguchi [mailto:Kohsuke.Kawaguchi_at_Sun.COM]
> Sent: Wednesday, July 12, 2006 4:27 PM
> To: users_at_jaxb.dev.java.net
> Subject: Re: Subclassing JAXB 2.0-generated classes
>
> Pelenur, Matias wrote:
> > @XmlElement(name = "someSubElement")
> > protected List<SomeSubElement> someSubElements;
> >
> > However, it doesn't seem like the unmarshaller ever calls the
> > getSomeSubElements() method that was overriden; instead, it
> seems to
> > directly access the someSubElements member variable (of the
> generated
> > class) and populate it. This happens even though the
> unmarshaller does
> > get an instance of my subclass correctly (from my ObjectFactory
> > subclass).
>
> Right. This is because the annotation is on a field, not on a method.
> Placing this on a method would cause unmarshaller to invoke them.
>
> --
> Kohsuke Kawaguchi
> Sun Microsystems kohsuke.kawaguchi_at_sun.com
>