The following table lists how the transformations transform UML elements into Java elements.
| UML element | Java element |
|---|---|
| Package | Java package with the same name |
| Package with the «perspective» stereotype | Ignored |
| Package with the «analysis» or «Analysis» keyword | Ignored |
| Class | Java class with the same name and visibility |
| Class with an Is Leaf property | Java class is final if true |
| Class with an Is Abstract property | Java class is abstract if true |
| Class with a generalization relationship | Java class extends the specified superclass |
| Interface realization or Realization relationship between a class and an interface | Java class implements the specified interface |
| Interface | Java interface with the same name and visibility |
| Interface with a generalization relationship | Java interface extends the specified interface |
| Enumeration | Java enumeration If the transformation is not configured to generate code that is compatible with J2SE 5.0, the transformation generates a Java interface with the same name and visibility. |
| Enumeration literal | Enumerator |
| Operation | Java method with the same name and visibility |
| Operation with an Is Static property | Java method is static if true |
| Operation with an Is Abstract property | Java method is abstract if true |
| Operation with an Is Leaf property | Java method is final if true |
| Operation with the same name as its class | Java constructor |
| Operation with the «create» stereotype | Java constructor |
| Operation with one or more UML classes specified in the RaisedException property | Java throws statement followed by the list of throwable classes |
| Parameter | Java parameter with the same name |
| Parameter with a type property | Java parameter has the specified type, which can be another class or a primitive type |
| Parameter with a direction property | Java method
has a return <param type> if it is set to return Java method with <param type> <param name> in its method signature if it is not set to return |
| Parameter or property with multiplicities: | |
| 0..1 | Attribute or reference |
| 1 | Attribute |
| N (N>1) | Array |
| x..* (for example, 1..*), *, or x..y | See the following table. In a list of operation
parameters, if the last operation parameter has a multiplicity of
* or x..*, by default it is transformed into a Java vararg (variable arity argument, which
is indicated by an ellipsis after the type).
Note: To override this
default behaviour and transform the last parameter into a Java collection, select the corresponding extension
in the transformation configuration.
If the operation parameter has a multiplicity of x..y, it is transformed into an array. |
| Property | Java field with the same name and visibility |
| Property with an Is Static property | Java field is static if true |
| Property with an Is Leaf property | Java field is final if true |
| Property with a type property | Java field has the specified type, which can be another class or a primitive type |
| isOrdered property | isUnique property | UML collection | Generated Java type |
|---|---|---|---|
| true | true | Ordered set | java.util.SortedSet |
| true | false | Sequence | java.util.List |
| false | true | Set | java.util.Set |
| false | false | Bag | java.util.Collection |
/*
* <!-- begin-UML-doc -->
* <!-- end-UML-doc -->
*/