简体   繁体   English

查找 java 类之间的关系

[英]Finding relationship between java classes

I would like to create a graph which contains Java classes of a program as nodes and the relationships between the classes as edges.我想创建一个图形,其中包含程序的 Java 类作为节点,类之间的关系作为边。 How can I determine the relationships between classes?如何确定类之间的关系? I thought about checking the import statements, but they are often inaccurate because of the * wildcard.我考虑过检查导入语句,但由于 * 通配符,它们通常不准确。

You are going to need a compiler.您将需要一个编译器。

Or look at compiled code.或者查看编译后的代码。

Easiest kludgey way: Load the code and apply java.lang.reflect (or a library which uses that).最简单的方法:加载代码并应用java.lang.reflect (或使用它的库)。

The difficult way: Read the class files.困难的方法:阅读 class 文件。 Probably use one of the libraries which handles this.可能使用处理此问题的库之一。

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

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