简体   繁体   中英

Java Exception class diagram ?

Hi I have a terrible memory and I wanted to print out class diagram of Java SE Exception Classes hang it on the wall or something I know I don't need to memorize it, It's just when you're designing a software or preparing for an exam it's good to have stuff like these around you.

I've googled most of the pictures aren't complete and are bad quality, So I was thinking of converting Javadocs to UML? then print out the uml maybe

Can someone help me please?

I can't remember all of them, either. When in eclipse I simply use the built-in functionality to display the hierarchy:

  • type F4 on a class definition and it displays the hierarchy
  • type Ctrl + Shift + H , enter the type you're looking for and press enter. Again, it shows you the hierarchy
  • after the hierarchy is available in "Hierarchy" view you can filter by eg using working sets.

Not really the answer to your question, but this works fine for me and everyone I've talked to so far.

BTW: Make a screenshot of the "Hierarchy" view and this is the answer to your question:-)

Few statistics from OpenJDK 7u3 rt.jar:

  • Throwable hierarchy: 785 classes
  • Error hierarchy: 63 classes
  • Exception hierarchy: 730 classes
  • RuntimeException hierarchy: 242 classes

So it's impossible to have full diagram. Probably you will not use exceptions from subpackages of com.sun, org.omg or most of javax. Normally you work on some subset of exceptions. I personally use the same approach as SJuan - search for exceptions in one particular package or package subtree.

Free Class Visualizer can do that for you - not as a diagram, but as a hierarchy tree. You can see part of sub-tree of Throwable on a screenshot on the project's Features page. To get the desired result: load rt.jar into the tool, search for Throwable on the hierarchy view and enjoy exploring hundreds of exceptions. If your application declares some exceptions, load it to the tool as well - you will see them on the hierarchy.

Try going to the official java documentation and from the page below you can click on any subclass, then subclass of the subclass and so on until you find what you want.

http://docs.oracle.com/javase/7/docs/api/java/lang/Exception.html

You can reverse engineer your java code into an UML class diagram. It could help to have a better vision of the existing code. some tools are pretty good in reverse specially with Java. Just google the following words "reverse engineering java eclipse" and you get what you need.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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