简体   繁体   English

如何生成Kotlin代码的Diagrams和UML?

[英]How do I generate Diagrams and UML of Kotlin code?

How do I generate UML and diagrams for Kotlin code? 如何为Kotlin代码生成UML和图表? I don't think getting the paid version of Intellij is an option for me. 我不认为获得Intellij的付费版本是我的选择。 I have been trying Intellij plugins and I haven't found anything that works yet. 我一直在尝试Intellij插件,我还没有发现任何有效的东西。

I would like to generate the diagrams and uml from the Kotlin code I have already written. 我想从我已编写的Kotlin代码生成图表和uml。 A tool like this would save me a lot of time. 像这样的工具可以节省我很多时间。

Thanks 谢谢

you can click only on a package in the project tree and click "Show Diagram...". 您只需单击项目树中的包,然后单击“显示图表...”。 Also it generates diagram from the Java point of view (shows Java's signatures and facade classes) 它还从Java的角度生成图表(显示Java的签名和外观类)

在此输入图像描述

May be it help others. 可能对别人有所帮助。

Currently, existing class diagram generator like SimpleUML(You can download it from android studio plugin repository) is not able to create class diagram of Kotlin class. 目前,现有的类图生成器如SimpleUML(可以从android studio插件库下载)无法创建Kotlin类的类图。 But you can use this plugin for Kotlin with little more effort. 但是你可以使用这个插件为Kotlin付出更少的努力。

Open activity class in android studio. 在android studio中打开活动类。

Go to tool -> Kotlin -> Show Kotlin Bytecode. 转到工具 - > Kotlin - >显示Kotlin字节码。 New side tab will open and show byte code of selected activity class. 新的侧面选项卡将打开并显示所选活动类的字节代码。

Click on top decompile of generated Kotlin bytecode which generate className.decompile.java class. 单击生成的Kotlin字节码的顶部反编译,生成className.decompile.java类。

Click on class name and then right click on mouse. 单击类名,然后右键单击鼠标。 In many options click on 'add to simpleUML diagram'. 在许多选项中,单击“添加到simpleUML图表”。 Create new or add diagram in existing file. 在现有文件中创建新图表或添加图表。

If you face problem, let me know. 如果您遇到问题,请告诉我。

Note: - If you will install SimpleUML then it may create issue. 注意: - 如果您将安装SimpleUML,则可能会产生问题。 Make sure you download SimpleUMLCE for working in the best way. 请务必下载SimpleUMLCE以便以最佳方式工作。

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

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