Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
284 views
in Technique[技术] by (71.8m points)

javadoc custom tags

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 >

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?

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...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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

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.

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"

  • 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.

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

-tag todo:a:"To Do:"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...