Hi there,
(I've posted this already to the "JAXB 2.0 and JAX-WS 2.0", just in case
nobody is reading this list)
I'm implementing a plugin which allows (simple) arbitrary annotation for fields
and classes generated by xjc using customization elements. Right now I can annotate
my code using predefined Annotations, which means the fully quallified names of
annotation classes are hard-coded. I'd like to change that and wondered if it's
possible to define a "schema-wide" customization, s.th. like the stuff used in
http://java.sun.com/xml/ns/jaxb for <jaxb:globalBindings />... I mean class
customizations are obtained using the ClassOutline, field customizations can
be fetched from FiedlOutline, but what about global stuff? What if I want to
get the infos defined in <foo:fieldAnnotation name="a.b.c.d" /> or
<foo:classAnnotation name="a.b.c.f" />?
Maybe the example below makes it a bit clearer:
<xs:schema xmlns:xs="
http://www.w3.org/2001/XMLSchema"
xmlns:foo="
http://example.com/ns/foo"
xmlns:jaxb="
http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="
http://java.sun.com/xml/ns/jaxb/xjc"
jaxb:extensionBindingPrefixes="xjc foo"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
jaxb:version="2.0">
<xs:annotation>
<xs:appinfo>
<jaxb:globalBindings>
<xjc:superClass name="my.fancy.Class"/>
<xjc:simple />
<xjc:serializable uid="123456789" />
</jaxb:globalBindings>
<foo:fieldAnnotation name="a.b.c.d" />
<foo:classAnnotation name="a.b.c.f" />
</xs:appinfo>
</xs:annotation>
<!-- elements declaration etc... -->
</xs:schema>
Is it possible at all or should I just supply the annotation classes through xjc
arguments (which would be quite ugly btw) and parsing them in Plugin#parseArguments()?
Any hints are greatly appreciated :)
Cheers,
Igor