Using IntelliJ IDEA Diagrams to Visualize and Optimize Servlet Inheritance Relationships
This tutorial demonstrates how to leverage IntelliJ IDEA's diagram feature to view, clean up, and enrich the inheritance and interface implementation hierarchy of Java Servlet classes, including removing irrelevant nodes, inspecting class members, adding new classes, and jumping to source code.
When I had some free time, I revisited my knowledge of Servlets and discovered that the inheritance and interface implementation relationships were a mess in my mind.
Using IntelliJ IDEA's diagram tool, I was able to generate a clear visual representation of the class hierarchy, which I’m sharing here.
1. View the graphical inheritance chain
In the class file tab, right‑click and choose Diagrams → Show Diagram (or the popup version) to open the diagram either embedded or as a floating window.
You can also right‑click the class in the project tree and select Diagrams to achieve the same result.
The resulting diagram for a custom Servlet class clearly shows:
Blue solid arrows indicate inheritance.
Green dashed arrows indicate interface implementation.
2. Optimize the inheritance diagram
2.1 Remove unimportant classes
Objects like Object and Serializable clutter the view; simply select them and press the Delete key.
After cleaning, the diagram looks like this:
2.2 Show detailed class information
Right‑click the diagram and choose Show Categories to expand fields, methods, constructors, etc., or use the toolbar button for the same purpose.
You can also filter by visibility level (e.g., show only protected and above) via Change Visibility Level .
2.3 Add other classes to the diagram
Select Add Class to Diagram , type the class name, and it will appear alongside the existing nodes.
If the added class has no direct relationship, it will appear without arrows, as shown with a Student class.
2.4 Jump to source code
Double‑click a class in the diagram, then right‑click a method and choose Jump to Source to open the actual code.
Use the Structure tool window to view all members of the class and navigate quickly.
3. Conclusion
By leveraging these IntelliJ IDEA features—diagrams, category view, visibility filters, adding classes, and source navigation—you can comfortably explore class relationships and understand the architecture of major frameworks.
Top Architect
Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.