dev@jaxb.java.net

RE: Several serialization strategies using JAXB

From: Moshe Einhorn <Moshe_at_imperva.com>
Date: Thu, 26 Oct 2006 17:36:48 +0200

I've started making a patch for this issue, and I have a few remarks:
1. Kohsuke - is there a way to pass AnnotationReader to the SchemaGen,
like to the JAXBContext?
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.
3. I couldn't find a way to create XmlTransient as a Annotation.

What i did was create a dummy method that had @xmlTransient and
extracting this annotation:

    @XmlTransient
    public void annotationsHolderDummyMethod(){
    }

    public Annoation getXMLTransientAnnotation(){
        Annotation a =
this.getClass().getMethod("annotationsHolderDummyMethod").getAnnotation(
XmlTransient);
        return a;
    }

its pretty ugly. Is there another way?

-----Original Message-----
From: Kohsuke Kawaguchi [mailto:Kohsuke.Kawaguchi_at_Sun.COM]
Sent: Saturday, September 30, 2006 12:20 AM
To: dev_at_jaxb.dev.java.net
Subject: Re: Several serialization strategies using JAXB

Kohsuke Kawaguchi wrote:
> Yes. We need to fix that, but I can do that very easily. Most likely
> we'll take an instance of AnnotationReader through
> JAXBContext.newInstance()'s Map property.
>
> I'll try to get this done in this afternoon and let you know.

Done. See JAXBRIContext.ANNOTATION_READER

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com