users@jaxb.java.net

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

From: Larry Talley <Larry.Talley_at_noaa.gov>
Date: Wed, 15 Dec 2010 13:18:11 -0900

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