Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: Michael_Giroux on May 25, 2006, 10:44:12 am
-
Using 6.1.790
Background:
If I create a new project using the default project template and select only the Class Model, I get a project with a root node named "Model" with a subordinate node "Class Model" and another subordinate node named "System".
Model
..Class Model
....System
....Frameworks
Now if I generate code for the "System" node, I'm getting an invalid java package statement:
package Class Model.System;
Two problems here, a) the space between Class and Model, and the use of upper case letters.
Question #1
It seems that the java package name will derive from the node names, so it seems that I need to rename "Class Model" to something like "com.myco". Also, "System" should be renamed to be a desired package name.
Is this the intended use, or is there a more appropriate way to control java package names?
Question #2
If a project defines three packages:
com.myco.utils
com.myco.utils.file
com.myco.utils.date
How should this be defined in the EA project? Should each of these be defined as a package with name as shown above, or should there be a structure of nested packages that resembles the file system structure?
com
..myco
....utils
......file
......date
[/font]
-
The ideal situation is to have one package for each level of your package path. However you can stop namespace generation at any package by setting it as a namespace root. (See http://www.sparxsystems.com.au/EAUserGuide/index.html?namespaces.htm)
We're also planning on modifying that model pattern so that Class Model is a namespace root when it is imported.