This is one of the choices for Assignment 3.
Objectives: Using reflective properties of programming languages - using Introspection
Standard requirements: The tool accepts as command line arguments the name of a compiled file (could be a *.jar file or a *.dll / *.exe file) and extracts all informations that are needed to describe the class diagram of the classes contained in this file. The standard requirement is to display (in a textual representation of your choice) all the informations that would go into the class diagram: classes, interfaces, methods, fields, relationships between classes/interfaces.
For Java implementation: In order to work with jar files use the utility class java.util.jar.JarFile to open a jar file. Use a URLClassLoader to load classes and retrieve the Class metaobjects. Use intensivly introspection to gather information.
Optional requirements: Bonus 2 points: Your tool must produce outputs compatible with the formats required by UML drawing tools such as yuml and plantuml. You can see on their respectives websites what are their required notations.
Implement a good design for your tool, such that new output formats for different UML drawing tools can be added with minimal effort and no changes to the main parts of tool.
Your tool also must be able to receive additional configuration options:
Cardinality of association relationships is ignored.
When parametrized types are found, include also its actual type arguments in the diagram.
Example: for the code given in TempSensor.jar:
If you select as target yuml, your tool produces the output TempSensor-yuml.txt. If you put this description in yuml it will draw the reverse engineered classdiagram of TempSensor
If you select as target plantuml, your tool produces the output TempSensor-plantuml.txt. If you put this description in plantuml it will draw the reverse engineered classdiagram of TempSensor
Example2: For the code given in EventNotifier.jar and target yuml your tool produces the output EventNotifier1.txt if the tool is used with the option to put class members on the diagram, respectively EventNotifier2.txt if it is used without this option. The class diagrams drawn by yuml are classdiagram case 1 respectively classdiagram case 2.