如何从 jaxb 文件生成 javaDoc

发布于 2024-08-24 12:03:17 字数 63 浏览 4 评论 0原文

我正在与 Jaxb 合作。我想从这些类生成 javaDoc 文件,这与我对常规 java 文件执行的方式相同吗?

i am working with Jaxb. and i would like to generate javaDoc files from these classes, is it the same way as i would do it to a regular java files?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

贪了杯 2024-08-31 12:03:17

您可以将 xs:annotationxs:documentation 一起使用,jaxb 会选取它们并使它们成为类上的 javadoc。

注意:

  • 当 xs:documentation 标签为
    在 xs:complexType 标记之外,它
    没有接听(可以理解)
  • 我假设可以在
    .xsd 中的属性/元素级别
    对于班级的领域,但没有尝试。
  • 如果你尝试添加 HTML 标签,输出会很难看
    在文档中。有
    可能有办法解决这个问题,但我
    也没有尝试过。
    <xs:complexType name="TypeThatBecomesJavaClass">
      <xs:annotation>
       <xs:documentation>
           This becomes javadoc for TypeThatBecomesJavaClass
      </xs:documentation>
     </xs:annotation>
    ... etc ... 

You can use the xs:annotation with xs:documentation and jaxb picks them up and makes them javadoc on the class.

Notes:

  • when the xs:documentation tag was
    outside the xs:complexType tag, it
    didn't pick up (understandably)
  • I'll assume the same can be done at the
    attribute / element level in the .xsd
    for fields of the class, but didn't try.
  • the output is ugly if you try to put HTML tags
    in the documentation. There's
    probably a way around that, but I
    didn't try that either.


<xs:complexType name="TypeThatBecomesJavaClass">
<xs:annotation>
<xs:documentation>
This becomes javadoc for TypeThatBecomesJavaClass
</xs:documentation>
</xs:annotation>
... etc ...

献世佛 2024-08-31 12:03:17

解决上述问题的更直接的方法(来自 JAXB 教程): http://jaxb.java.net/tutorial/section_5_4-Adding-Documentation.html#Adding%20Documentation

A more direct approach (from the JAXB tutorial) which addresses the concerns above: http://jaxb.java.net/tutorial/section_5_4-Adding-Documentation.html#Adding%20Documentation

秋叶绚丽 2024-08-31 12:03:17

假设您已从 .xsd 生成了 .java 文件 - 是的,它们是您可以修改、注释和记录的常规类。

Assuming you have generated .java files from .xsd - yes, they are regular classes which you can modify, comment and document.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文