Yes - I understand that it wouldn't be part of the JAXB specification. My
question was just on the syntax of how to express the mapping to a
field. Couldn't it be done using an extension binding declation - as
described in
Section 7.1.1? I.e., where the namespace for the field mapping declaration is
specified using the <jaxb:extensionBindingPrefixes>.
So, for example:
<schema ...
xmlns:jaxb-fmap="
http://someurl"
jaxb:extensionBindingPrefixes="jaxb-fmap">
<complexType name="Foo">
<sequence>
<element name="bar1" type="xs:string"/>
<element name="bar2" type="xs:string">
<annotation><appinfo>
<jaxb-fmap:field>
</appinfo></annotation>
</sequence>
</complexType>
</schema>
Then a schema compiler that understands the extension would map 'bar1' to the
normal setter/getter; but 'bar2' would get mapped to the bare field:
protected String bar2;
without any setter/getter.
Does this make any sense? Or am I misunderstanding the use of
jaxb:extensionBindingPrefixes?
-- Mark
Quoting Kohsuke Kawaguchi <kohsuke.kawaguchi_at_sun.com>:
> Mark Hansen wrote:
>> I assume this mapping to a Field would be specified with a binding
>> language extension as described in Section 7.1.1 of the JAXB
>> specification?
>
> No, it's somewhat unlikely for the spec to talk about such bindings
> at this point (given that it's "proposed final draft" already.)
>
> It's just that nothing prevents from anyone to quickly hack our XJC
> to generate any code he wants. Such compiler can't be certified as
> JAXB 2.0 schema compiler, but nonetheless it would be very useful.
> And the code that such a compiler generates will run on any JAXB 2.0
> runtime (as long as you only use JAXB 2.0 annotations), so it's as
> portable as you can get.
>
> --
> Kohsuke Kawaguchi
> Sun Microsystems kohsuke.kawaguchi_at_sun.com
>