users@jaxb.java.net

Re: Can I specify the annotation retention policy for Java annotations written for me by XJC?

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Thu, 16 Dec 2010 10:15:48 +0100

But they all have @retention( value=RUNTIME ), see
javax.xml.bind.annotation.*
-W

On 15 December 2010 23:18, Larry Talley <Larry.Talley_at_noaa.gov> wrote:

> I would like to have runtime access (via reflection) to the Java
> annotations written for me by XJC. I haven't seen a way to tell XJC that I
> want RententionPolicy.RUNTIME for those annotations.
>
> Or perhaps there are other ways to accomplish my objective.
>
> At runtime I want to interrogate objects that have been unmarshalled from
> XML, and treat those objects that were defined in the schema as xs:date
> slightly differently than those that were in the schema as xs:dateTime. If
> I could get RetentionPolicy.RUNTIME set for the JAXB annotations, I could
> use that to differentiate.
>
> Is there a way to ask JAXB to generate annotations with a
> RetentionPolicy.RUNTIME, or, is there a better approach?
>
> Larry Talley
>