[dbdoclet] Re: Annotations in docbook output

Michael,

Thanks for the quick response!

Ok, I didn't realize the annotation classes needed to be available for the annotation to be recognized as such, but that makes sense. So, I think I've done that, and it's still not working. However, adding @Deprecated to a member does make that annotation appear in the output.

Unfortunately I can't send you this code, it's currently proprietary, and that makes this rather tough. But I'll try to explain.

I've got, for example, a protected member variable called reportType, and it actually has several annotations on it, like so:

    @XmlElement
    @DynamicSerializeElement
    @Column
    @Deprecated // added by me to test
    protected String reportType;

If I'm understanding correctly, @XmlElement comes from JAXB (package javax.xml.bind.annotation), @Column comes from Hibernate (package org.hibernate.annotations), and DynamicSerializeElement is a custom annotation the developers created.

I've now added enough stuff to my classpath that I am not getting any errors or warnings when running the javadoc tool (e.g. "package ... not found" or "cannot find symbol"), but when the script is finished this is what is output for this member:

         <fieldsynopsis language="java">
           <modifier role="annotation">@Deprecated</modifier>
           <modifier>protected</modifier>
           <type>java. lang. String</type>
           <varname>reportType</varname>
         </fieldsynopsis>

So, the @Deprecated annotation does come out, but I've got none of the other annotations listed. I have at least the jar for the DynamicSerializeElement classes and the hibernate-annotations jar explicitly in my classpath environment variable, and like I said, get no errors or warnings. If it matters, I'm only running the javadoc tool on two files currently to test this, because I have to allocate about 4GB of memory to javadoc's jvm if I want to run this against the entire project. 8-|

Any ideas?

-Matt

P.S.: the use-case here is that the objects with these annotations are serialized and made available through different web service endpoints-- so what I want to do is use the docbook output to generate reports of which objects and which members are available to be consumed from those web services. If you can think of a better tool for this, I'd be interested to hear any suggestions.


On Nov 5, 2009, at 2:16 PM, Michael Fuchs wrote:

Hello Matt,

I made a short test with the @Deprecated annotation and everything went fine. The annotation is represented as <modifier> element in the output.

Do you have the jaxb libraries in your classpath? As far as I can
remember, the definition of the annotations must be present on the
classpath. Can you also make a short test with @Deprecated annotation?

If the problem is not solved, please send me an example.

Regards
Michael

Am Donnerstag, den 05.11.2009, 14:06 -0600 schrieb Matthew Williamson:
Hello list,

I'm trying to make the docbook output include the fact that a given
member variable has a certain annotation attached to it. For example,
I want to be able to see if a member has the @XmlElement annotation
and is therefore JAXB serialized.

I've run the tool using javadoc -docletpath ... -doclet ... , and the
members I want to look at come out with <modifier> and <type>
properly, but nothing indicating any annotations. Also, I don't see
that annotations on the class (e.g. @XmlRootElement) are reflected in
the output either.

I read that dbdoclet added "Support for annotations" in v0.70.0, does
that mean that this is possible? Or is this not something that can be
done?

Thanks,
-Matt






Other related posts: