java 生成Java类层次图的应用程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1168753/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 15:29:21  来源:igfitidea点击:

Application to generate Java class hierarchy diagram

javavisualizationclass-hierarchycall-graph

提问by Dave Jarvis

Looking for a tool that:

寻找一种工具:

  • Produces a visually pleasing (not garish), orthogonally structured graph hierarchy
  • Outputs high-quality PNG images (300dpi+)
  • Visually differentiates classes, abstract classes, interfaces, and enumerated types (preferably by colour)
  • Interactive user interface
  • Allows pruning of packages and/or individual classes from the diagram
  • Seeds (e.g., File » Open) using a set of:
    • Directories
    • JAR files
    • Individual source files
    • Individual compiled classes
  • Performs a fully automatic analysis of class dependencies
  • Searches classpath to resolve as many unmet dependencies as possible
  • Uses a single executable
  • Is lightweight (~5MB) and fast (loads in under one second on an average 1.5GHz machine)
  • Is simple (under 10 clicks to generate a graph)
  • Is quick (graph 100 objects in a few seconds)
  • Is easy to use (minimal interface, focused on graph generation)
  • Is OSS or GPL
  • (Optional) Generates a call-graph hierarchy
  • 产生视觉上令人愉悦(不花哨)的正交结构图层次结构
  • 输出高质量的 PNG 图像 (300dpi+)
  • 在视觉上区分类、抽象类、接口和枚举类型(最好通过颜色)
  • 交互式用户界面
  • 允许从图中修剪包和/或单个类
  • 种子(例如,File » Open)使用一组:
    • 目录
    • JAR 文件
    • 单独的源文件
    • 单独编译的类
  • 对类依赖执行全自动分析
  • 搜索类路径以解决尽可能多的未满足的依赖项
  • 使用单个可执行文件
  • 轻量级(~5MB)且速度快(在平均 1.5GHz 的机器上加载时间不到一秒)
  • 很简单(点击 10 下即可生成图表)
  • 很快(在几秒钟内绘制 100 个对象)
  • 易于使用(最小界面,专注于图形生成)
  • 是 OSS 还是 GPL
  • (可选)生成调用图层次结构

Tools that will not accomplish this task include:

无法完成此任务的工具包括:

  • Doxygen + GraphViz (or dot)
  • Eclipse
  • UML modellers
  • Structural Analysis for Java (cannot parse source files)
  • JUDE Community (awkard interface, unsuitable autogeneration)
  • Integrated development environments (too complex, and use too much memory)
  • Doxygen + GraphViz(或点)
  • UML 建模器
  • Java 的结构分析(无法解析源文件)
  • JUDE社区(丑陋的界面,不合适的自动生成)
  • 集成开发环境(太复杂,占用内存太多)

Any ideas?

有任何想法吗?

回答by Jonatan Ka?mierczak

It seems that Class Visualizermeets all your requirements (except of saving diagram as PNG).

Class Visualizer似乎满足您的所有要求(将图表保存为 PNG 除外)。

回答by Andrea Francia

The Netbeans UML plugin will cover some of your requirements.

Netbeans UML 插件将满足您的一些要求。

  • Produces a visually appealing graph hierarchy: a matter of taste
  • Writes high-quality PNG images (300dpi+): I don't know
  • Visually differentiates classes, abstract classes, interfaces, and enumerated types: yes it does as it uses UML
  • Interactive user interface: yes
  • Allows pruning of packages and/or individual classes from the diagram: yes
  • Seeds (e.g., File ? Open) using a set of: it work with netbeans projects
    • Directories
    • JAR files
    • Individual source files
    • Individual compiled classes
  • Performs a fully automatic analysis: maybe
  • Uses a single executable: not applicable, it's a plugin of Netbeans
  • Is lightweight and fast: like netbeans
  • Is simple, quick, and easy to use: depends of user
  • Is OSS or GPL: I think it is OSS, surely it is free as in free drink
  • (Optional) Generates a call-graph hierarchy (in addition to a class hierarchy): I don't think it does
  • 产生视觉上吸引人的图形层次结构:品味问题
  • 写入高质量的 PNG 图像(300dpi+):我不知道
  • 在视觉上区分类、抽象类、接口和枚举类型:是的,因为它使用 UML
  • 交互式用户界面:
  • 允许从图中修剪包和/或单个类:是
  • 使用一组种子(例如,文件?打开):它适用于 netbeans 项目
    • 目录
    • JAR 文件
    • 单独的源文件
    • 单独编译的类
  • 执行全自动分析:也许
  • 使用单个可执行文件:不适用,它是 Netbeans 的插件
  • 轻量级和快速:就像 netbeans
  • 简单、快速且易于使用:取决于用户
  • 是 OSS 还是 GPL:我认为是 OSS,肯定是免费的,就像免费饮料一样
  • (可选)生成调用图层次结构(除了类层次结构):我认为不会

回答by Stephen C

The answer is probably "no such OSS / free application exists". Why? Because:

答案可能是“不存在这样的 OSS/免费应用程序”。为什么?因为:

  1. Most people who want an inheritance diagram for a large number of classes are already working in the context of an IDE or similar. Ergo there is little motivation for OSS developers to produce such a tool.
  2. Automatically creating visually appealing diagrams of large numbers of classes is next to impossible.
  1. 大多数想要大量类的继承图的人已经在 IDE 或类似环境中工作。因此,OSS 开发人员几乎没有动力生产这样的工具。
  2. 自动创建大量类的视觉吸引力图表几乎是不可能的。

I suggest that you relax your requirements. I mean, what is wrong with using a large scale IDE or UML modeller? Memory is cheap. What is wrong with waiting a few seconds to load / run the diagrammer? Patience grasshopper! What high-school student with 2 days of training is going to be looking at source-code base with 10,000+ classes???

我建议你放宽你的要求。我的意思是,使用大型 IDE 或 UML 建模器有什么问题?内存便宜。等待几秒钟来加载/运行绘图仪有什么问题?耐心的蚂蚱!哪个接受过 2 天培训的高中生会查看 10,000 多个课程的源代码库???