users@jaxb.java.net

Re: Problem with xs:element->xs:annotation->xs:documentation for a simple type

From: Sandy McP <sandy.mcpherson_at_xs4all.nl>
Date: Tue, 10 Mar 2009 04:54:29 -0700 (PDT)

>> I am writing a plugin to get at the element documentation (the get method
>> javadoc). So that I can use this as a default title for GUI components in
>> my
>> JSF pages. I have written a plugin to get the javadoc and write the
>> method.

> Might be a bug, try tracing how documentation is read from the schema.
> In any case you must have access to XSComponent from the property and
> you can get your annotations from there.

Tried that already

prop.getSchemaComonent().getAnnotation()

returns null...

I have few comments for you:

> You're creating a new subclass for your "GetLabel"-enabled fields. I
> don't think it is a good design decision. You'll have to create
> subclasses for all field classes out there. Essentially, you don't
> need this: better iterate over outline/class outlines/field outlines
> and generate additional getters, you don't need special field
> subclasses for this. This will be much simpler.

OK... Will do. I wasn't trying to win any elegance competition, just trying
to see if it works at all....

> Direct statements in code model are evil. Code model was especially
> developed to produce the code programmatically. Try something like
> method.body()._return(JExpr.lit(label)).

Done... Thanks

> You can have special-purpose XML customization for your plugin.
> Imagine something like:

> <xs:element ref="SET:VESSDAT" minOccurs="0">
> <xs:annotation>
> <xs:appInfo><my:label>Hello World</my:label></xs:appInfo>
> </xs:annotation>
> </xs:element>

> Instead of misusing xs:documentation for your custom purposes.

I have no control over this schema, it is produced by someone else and has
been in use for years. I just have to use it as is.


-- 
View this message in context: http://www.nabble.com/Problem-with-xs%3Aelement-%3Exs%3Aannotation-%3Exs%3Adocumentation-for-a-simple-type-tp22431465p22432704.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.