See also


Languages such as Java support package structures or namespaces.

Enterprise Architect lets you specify a package as a Namespace Root, which denotes where the namespace structure for your class model starts; all subordinate packages below a namespace root will form the namespace hierarchy for contained Classes and Interfaces.

To define a package as a namespace root, right-click on the package in the Project Browser and select the Code Engineering | Set as Namespace Root context menu option; the package icon in the Project Browser changes to show a colored corner indicating this package as a namespace root (NamespaceRootIcon).

Generated Java source code for example will automatically add a package declaration at the beginning of the generated file indicating the location of this class in the package hierarchy below the namespace root.

To clear an existing namespace root, right-click on a namespace root package in the Project Browser and select the Code Engineering | Clear Namespace Root.

To view a list of namespaces, select the Settings | Namespace Roots menu option; the Namespaces dialog displays.  If you double-click on a namespace in the list, the package is highlighted in the Project Browser; alternatively, right-click on the namespace to display a context menu, and select the Locate Package in Browser menu option.  You can also clear the selected namespace root by selecting the Clear Namespace Attribute option.

To omit a package from a namespace definition, select the Code Engineering | Suppress Namespace context menu option; to include the package in the namespace again, select the Code Engineering | Show Namespace context menu option.




When performing code generation, any package name that contains whitespace characters is automatically treated as a namespace root

Learning Center topics

(Alt+F1) | Software Engineering | Generate Code | Namespaces