users@jaxb.java.net

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

From: Larry Talley <Larry.Talley_at_noaa.gov>
Date: Thu, 16 Dec 2010 16:58:30 -0900

Oops, apparently those annotations created by XJC already have the
RetentionPolicy.RUNTIME; once I corrected errors in my use of reflection
I am finding the annotations I was looking for.

Thanks anyway!

Larry

On 12/15/2010 1:18 PM, Larry Talley 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