Generated Files for Classes in Java Code

When generating Java code from UML classes, three files are generated: <ClassName>.java, <InterfaceName>.java, and <EnumerationName>.java.

The description for the <ClassName>.java, <InterfaceName>.java and <EnumerationName>.java files is identical. In this topic, the three file names are replaced with <ObjectName>.java where Object means altogether Class, Interface, and Enumeration.

The <ObjectName>.java files describe the content of a class entity. These files declare and implement the elements that are associated with a class.

Element Description
File
  • The <ObjectName>.java file is generated for each UML class, interface, and enumeration element that is involved in the code generation.

  • The file name <ObjectName>.java matches the name of the element.

  • The <ObjectName>.java file is generated in a folder reflecting the package structure of the UML project.

    Example of a Java folder hierarchy:

Package

The package in which the <ObjectName>.java file is generated is declared on top of the file after the header.

Example of a package declaration:

package root.myPackage;

Import

The import of other classes, interfaces, enumerations on which the current class depends (for relations such as inheritance, composition, aggregation, usage) is generated.

Example of an import declaration:

import root.otherpackage.LockableElement;

See Generated Java Code for Classes.

Class description

The class is described using the regular Java declaration mechanism.

Interface description

The interface is described using the regular Java declaration mechanism.

Enumeration description

The enumeration is described using the regular Java declaration mechanism.