| Stereotype | Validated source model element |
|---|---|
| «JavaClass» | Class |
| «JavaEnum» | Enumeration |
| «JavaEnumConstant» | Enumeration literal |
| «JavaField» | Attribute in a class |
| «JavaInterface» | Interface |
| «JavaMethod» | Operation in a class |
| «JavaPackage» | Package |
| «JavaParameter» | Input, output, or return parameter |
The UML-to-Java transformation profile also contains stereotypes that the UML-to-Java transformation uses to generate Java code for arrays and collections. These stereotypes are applied automatically when you run the transformation. Applying these stereotypes does not affect modeling activities.
| Stereotype | Applicable UML element | Properties | Property description and values | Transformation result |
|---|---|---|---|---|
| «JavaArray» | Property, parameter | dimensions | Specifies the size of the array Default value is 1 |
Java arrays of arbitrary dimensions For example, to generate an array of the form int[][], apply the «JavaArray» stereotype to a property or parameter, set the type of the attribute to primitive type int, and set the dimensions value to 2 |
| «JavaCollection» | Property or parameter; represents Java collection classes such as Set, List | collectionType | Set to the fully qualified name of the Java collection
to generate Default value is java.util.Collection |
Java collection classes such as Set, or
List For example, to generate a map of type Hashmap<String, Object>, you can apply the «JavaCollection» stereotype to a UML property or parameter, set the collectionType to java.util.Hashmap, and set the keyType to java.lang.String |
| keyType | Set to the fully qualified name of a key type used
in java.util.Maps Do not specify a value if the collectionType property is not a Java map class No default value |