users@jaxb.java.net

Re: Customization namespaces and "vendor extensions"

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Wed, 19 Jan 2005 09:12:58 -0800

Aleksei Valikov wrote:
> I would suggest that annotations are parsed into DOM nodes, class
> instantiation is a bit of overkill.

OK. That's good to know. That's even easier.


>> Internally, we first attach it to XSOM's XSElementDecl. Then our
>> compiler front-end runs, which creates a ClassItem for this element.
>> Because extensions can only run after we've finished the basic code
>> generation, we have to somehow attach your MYNSFile instance to one of
>> the model objects the front-end creates. But exactly which model object
>> we should attach your annotations isn't quite clear to me.
>>
>> For example, in your MYNSFile case, you'd almost want it on FieldItem,
>> not on ClassItem. But how the JAXB RI, without knowing the semantics of
>> your annotations, can determine whether it should put yours on a
>> ClassItem or a FieldItem? If I more or less randomly pick which
>> annotation goes to where, does that work for you?
>
> jaxb:property and jaxb:class solve the same problem for JAXB, don't
> they? The same approach could be used for custom annotations.

Because JAXB annotations are processed by the front-end, technically
they aren't propagated to the backend. In that sense it's not exactly
"the same".

I guess one simple approach would be for the JAXB RI to designate one
schema component for a class and one schema component for a property.
Then it can provide access to annotations on those components. Hopefully
having something would make it easy for us to talk about it.

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net