Java UML API/Library [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this questionIs there a Java API/Library that I can use to generate UML diagrams (Class, Sequence and Package)? I want to be able to embed the diagrams within my Java Application.
If you build your application on the NetBeans platform (or at least using Swing), you should be able to use the NetBeans UML plugin. Pay attention to the licencing (although I don't expect problems there) and NetBeans versions (the UML plugin isn't available for all NetBeans versions).
If you're building on Eclipse RCP, you could use the UML2 plugin.
You may try TextUML Toolkit which is able to represent UML model in textual notation and transform it to Graphviz read-only diagram. I believe (since I have no particular experience with the toolkit) it accepts also model in Eclipse EMF UML2 meta-model (which is one of its dependencies), so you could instantiate the UML model programatically.
There will be quite a bunch Eclipse EMF-related plugins dependencies. Learning curve won't be very flat (providing you have no former experience with Eclipse EMF), but drawing a UML diagram is not exactly a one-liner:)
You can have a look at this french tutorial I found on UMLGraph: http://rpouiller.developpez.com/tutoriels/java/generation-diagrammes-uml-avec-umlgraph/
For english translation I used google: http://translate.google.co.uk/translate?u=http%3A%2F%2Frpouiller.developpez.com%2Ftutoriels%2Fjava%2Fgeneration-diagrammes-uml-avec-umlgraph%2F&sl=fr&tl=en&hl=&ie=UTF-8
You have today two options today in modeling which are either to show static diagrams at any stage of your implementation code (e.g. UMLGraph or other plugins) or to use the model driven development (e.g. UML tools). All depends on the need.
I would not personally recommend only using Java graphical libraries because this is not UML. I mean that UML is composed by diagrams and a model. Graphical libraries such as UMLGraph just give you a graphical view of a package. This is like a pdf reader which is not sufficient as soon as you need to create your own pdf and share it with other users. I also don't see any interest just showing static diagram because this information is usually already available in the project tree view. I mean that you see classes and inners classes. Inheritances are visible in the first line of each class so really easy to see. Concerning associations and dependencies all this graphical libraries can not detect them or just basic links, or even wrong associations therefore you can't use associations or dependencies links with graphical java libraries. I mean that the java detection is very simple and therefore limited. You will never be able with graphical libraries to display all java information inside an UML class diagram because only 50% of the project would be displayed. If you have a lot of methods and attributes then your diagram would be so big that you will not be able to display the diagram on one page. You need advanced feature like show hide compartments, re-size etc which are only available inside traditional modeling tools.
I think that showing static UML class diagrams which only have 50% of the real java project information, are not visible by human eyes because bigger than a page, have no model and are programmatically generated by maven for example have no project value. The only value i see is psychological for the project manager showing diagrams with no sense for presentation purposes to end users who don't know what means UML modeling but believe they do know !!
See the nice standalone argouml application which should have some capabilities to display uml :-)
精彩评论