javadoc中排除类的一些公共的方法 [英] javadoc exclude some public methods from class

查看:612
本文介绍了javadoc中排除类的一些公共的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要排除的几个类的公共方法被纳入的javadoc。我想克里斯Nokleberg的ExcludeDoclet(sixlegs)。但doclet的是给一个小问题:
如果在类返回清单的其它方法(或任何其他泛型),
而不是被显示在Javadoc的列表,返回类型只是被显示为列表(没有通用的信息)

I have to exclude a few of the public methods of a class from being included in javadocs. I tried Chris Nokleberg's ExcludeDoclet (sixlegs). But the doclet is giving a slight problem : If the other methods in the class return List (or any other generics), instead of being displayed in the javadoc as List, return type is just being displayed as List (without the generic info)

谁能给一个暗示或者对如何解决这一问题提供了环绕工作?

Can anyone give a hint or provide a work around on how to solve this issue?

推荐答案

我假设你想从javadoc中排除是你不希望你的客户使用公共方法的方法。换句话说,这些方法德precated 。你需要做什么用@德precated注解是。像这样的:

I assume the methods you want to exclude from javadoc are public methods that you don't want your client to use. In other words, these methods are deprecated. What you need to do is using the @Deprecated annotation. Like this:

@Deprecated public void badMethod() {
    ...
}

现在,badMethod()是pcated德$ P $。如果有人在他的code使用badMethod(),他将得到来自编译器警告(他是用德precated法)。

Now, the badMethod() is deprecated. If someone uses badMethod() in his code, he'll get a warning from the compiler (that he's using a deprecated method).

不过,德@ precated标注不排除从javadoc中去precated方法。这里有您需要为了排除javadoc的方法做:当你生成Javadoc,使用的节点$ p $#的.html节点precated javadoc的CMD行选项。该-node precated选项prevents文档中的任何德precated API的产生。所以,如果你使用@德precated注释,并产生与-node precated选项的javadoc,你的坏法将不会出现在Javadoc。

However, the @Deprecated annotation doesn't exclude the deprecated method from javadoc. Here's what you need to do in order to exclude the method from javadoc: When you generate javadoc, use the nodeprecated javadoc cmd line option. The -nodeprecated option prevents the generation of any deprecated API in the documentation. So if you use the @Deprecated annotation and generate javadoc with the -nodeprecated option, your bad method won't appear in the javadoc.

但在我看来,你不应该排除您的javadoc德precated公共方法。如果出现与为何法德precated什么,而不是使用说明文档中这是更好的。

But in my opinion, you shouldn't exclude deprecated public methods from your javadoc. It's better if they appear in the documentation with an explanation of why the method is deprecated and what to use instead.

这篇关于javadoc中排除类的一些公共的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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