Class diagram can import java classes and covert them into class diagrams.
Importing a Java Class
Java code can be added to a ‘Class Diagram’ via the ‘Import Java’ button on the toolbar.
- Within a ‘Class Diagram’, click the ‘Import Java’ button on the toolbar.
- There are 2 import options for your Java class: text and file upload.
To upload text, simply paste your Java class code into the text box.
To upload a file, drag-and-drop your .java file over the drop area, or click within the drop area to browse your computer’s file system to select the file to upload.
- Verify that your Java file contains a package statement and the code uses valid Java 8 syntax. Once you have uploaded your file, click ‘Apply’ to parse the Java file into the ‘Class Diagram’.
- Assets (Java class), Attributes (Java class variables) and Operations (Java methods) are each parsed into the different Innoslate entities on the ‘Class Diagram’. For Attributes and Operations, the modifiers and annotations are added to the entity’s description. The Java type (i.e. int, String, etc.) is added to the entity’s ‘Units’ attribute. If the class variable was given an initial value in the declaration, that value is added to the entity’s ‘Value’ attribute.
The Java importer supports all of the basic Java 8 class structures, including Concrete, Enum, Static, Final, Abstract, and Interface.
The importer also supports nested classes which will be parsed into separate Assets and will draw the decomposition relationship between the 2 Assets if the outer Java class extends or implements the inner class.