javadoc 自定义标签 [英] javadoc custom tags

查看:64
本文介绍了javadoc 自定义标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在谷歌上搜索了将近一个小时,但找不到任何关于制作自定义标签的好信息.当我检查 javadoc 的帮助时,它说的是关于自定义标签...

I've been googling for almost an hour and I can't find any good information on making custom tags. When I check the help for javadoc is says this about custom tags...

-标签 <名称 >:<位置 >:<标题>

-tag < name >:< locations >:< header >

它没有定义任何事物是什么.我认为 name 将是标签的名称,标题可能是您生成 javadoc 时标签所说的内容,但什么是位置以及如何使用它?

It does not define what any of things are. I think name would be the name of the tag and header is probably what the tag says when you generate the javadoc but what is locations and how is it used?

名称、位置和标题也需要用引号引起来吗?

Also does the name, locations, and header need to be in quotes or anything like that?

一些自定义标签示例以及对位置的解释可能对我有很大帮助.我找不到关于制作 javadoc 的这个特定部分的任何好的教程......

A few examples of custom tags and maybe an explanation of what locations is would be a HUGE help for me. I can't find any good tutorials on this specific part of making a javadoc...

推荐答案

看起来你只调用了 javadoc -help.这只是关于选项的简短提醒,而不是完整的文档.

Looks you have only invoked javadoc -help. This is only a short reminder about the options, not a complete documentation.

原则上,所有内容都在 javadoc 文档页面(对于 WindowsLinux/Solaris).

In principle, everything is explained in detail on the javadoc documentation page (for Windows and Linux/Solaris).

-tag 选项 用于向标准 doclet 添加自定义标签,而无需创建自己的 taglet(在那里您将使用 -taglet 选项) 甚至是自己的 doclet.

The -tag option is for adding custom tags to the standard doclet without having to create an own taglet (there you would use the -taglet option) or even an own doclet.

选项的所有参数必须是一个命令行参数,因此根据您的 shell,如果它们包含任何空格,通常必须将它们(一起或单独)放在引号中.

All the parameters to the option have to be one command line argument, so depending on your shell you usually have to put them (together or individually) in quotes if they contain any spaces.

-tag tagname:Xaoptcmf:"taghead"

  • tagname 是您的自定义标记的名称 - 例如,如果您在源代码中编写 @todo,名称将是 todo.
  • 中间参数是允许使用此标签的位置的标识符.这可以是 a(无处不在)、o(仅在概览页面中)、p(在包文档上)、t(用于类或接口文档)、c(用于构造函数)、m(用于方法)、f(用于字段).此外,可以有一个 X 表示接受标签但不显示输出.(那么您就不需要 taghead 部分).
  • taghead 应该在生成的源代码中显示为标签的标题,例如 To Do: 用于我们的 todo 标签.
    • The tagname is the name of your custom tag - for example, if you are writing @todo in the source, the name would be todo.
    • The middle parameter is an identifier for the locations where this tag is allowed. This can be a combination of a (everywhere), o (only in the overview page), p (on package documentation), t (for class or interface documentation), c (for constructors), m (for methods), f (for fields). Additionally there can be an X meaning the tag is accepted but no output shown. (Then you don't need the taghead part).
    • The taghead is what should be shown in the generated source as the header for your tag, for example To Do: for our todo-tag.
    • 所以,如果你的 @todo 标签应该在任何地方都被允许并打印 To Do:,你会使用

      So, if you @todo tag should be allowed everywhere and print To Do:, you would use

      -tag todo:a:"To Do:"
      

      这篇关于javadoc 自定义标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆