users@jaxb.java.net

Re: More JAXBElement

From: Brian Pontarelli <brian_at_pontarelli.com>
Date: Fri, 18 Feb 2005 10:58:25 -0600

> The actual logic is that if the class has @XmlRootElement annotation,
> it returns the object itself, where as if it doesn't, it's returned as
> wrapped in JAXBElement.

Yeah, I've been decoding the annotations and I think I've got my head
around the basic ones.

> JAXBContext c = JAXBContext.newInstance(ObjectFactory.class);
>
> The suggest unmarshal method is really just:
>
> Object unmarshal( INPUT ) {
> Object o = currentUnmarshalMethod(INPUT);
> if(o instanceof JAXBElement)
> return ((JAXBElement)o).getValue();
> else
> return o;
> }
>
> right?
>
Exactly. Just as long as the JAXB implementation returns JAXBElement in
all cases than this will work fine.