简体   繁体   English

如何获得项目的所有类名和方法名?

[英]How do I get all the class names and method names of a project?

I have downloaded a huge project written in Java. 我下载了一个用Java编写的庞大项目。 I wish to know the Classes and Methods of every class that are available in the project (for further analysis). 我希望知道项目中可用的每个类的类和方法(以供进一步分析)。 How can I recover this information. 我该如何恢复此信息。 Can I try javadoc in eclipse? 我可以在Eclipse中尝试javadoc吗?

I guess you may ask about changing SVN properties. 我猜您可能会问有关更改SVN属性的问题。

Follow this step if that so. 如果是这样,请执行此步骤。

press Alt + Shift + Q Alt + Shift + Q

Select Show view (view : Outline) 选择显示视图(视图:大纲)

then under that u can see all details 然后在那下你可以看到所有细节

I have wrote a custom doclet to list the classname and its methods: 我编写了一个自定义doclet来列出类名及其方法:

public class ListClassAndMethods {

     public static boolean start(RootDoc root) {
            ClassDoc[] classes = root.classes();

            for(ClassDoc clazz : classes){
                System.out.println("Class Name: "+clazz);
                System.out.println("--------------------------");
                for(MethodDoc methodz :clazz.methods()){
                    System.out.println(methodz.name());
                }
            }
            return true;
        }
}

you need to run create a jar of this class and refer it while creating a javadoc using Eclipse IDE 您需要运行创建此类的jar并在使用Eclipse IDE创建javadoc时引用它

I would extract all the class source files (.java) with find (if you're on a *nix implementation) and create an empty NetBeans project with just one package and all the classess inside it. 我将使用find(如果您使用* nix实现)提取所有类源文件(.java),并创建一个仅包含一个包及其中所有类的空NetBeans项目。 Netbeans will correct the package declaration and you can easily use autogenerate javadoc to get a navigable web archive listing all the classes and public/protected methods. Netbeans将更正软件包声明,您可以轻松地使用自动生成的javadoc获得可导航的Web存档,其中列出了所有类和公共/受保护的方法。

Of course the code may not run anymore but you'll get what you want in minutes. 当然,该代码可能不再运行,但是您将在几分钟内获得所需的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM