dev@jaxb.java.net

Re: Several serialization strategies using JAXB

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Fri, 27 Oct 2006 11:03:09 -0700

Moshe Einhorn wrote:
> I've started making a patch for this issue, and I have a few remarks:

Cool! Keep us posted.


> 1. Kohsuke - is there a way to pass AnnotationReader to the SchemaGen,
> like to the JAXBContext?

Good point. I have to come up with a way to do it. In the meantime, the
workaround is to use JAXBContext.generateSchema().

> 2. The solution is not that simple since not only I have to had
> @XmlTransient when I have @NotInNetwork
> I also have to remove all the other annotations such as @xmlElement
> @XmlElementWrapper etc.
>
> The annotations are there in the first place since other Serializarions
> configuration might want to Serialize this property.

Yes, but I'm not too sure why it's hard. I'm looking forward to seeing
your code.

> 3. I couldn't find a way to create XmlTransient as a Annotation.

Two approaches. One is to implement this interface by yourself, like this:

     public class XmlTransientImpl implements XmlTransient {
         public Class<XmlTransient> annotationType() {
             return XmlTransient.class;
         }
     }

The other is to use java.lang.reflect.Proxy.

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com