Type variables are mapped to the UML Template Parameter of a UML Class, Interface or UML Operation, according to which Java element has type variables. If bound types are present, they are mapped into the UML Class or UML Interface connected with the UML Generalization or UML Interface Realization as a supplier. The client is a UML Class, which is a “Parametered Element” of the UML Template Parameter.
Type variable mapping table
Java Element | UML element |
---|---|
Type variable declaration | Mapped to the UML Template Parameter. This UML Template Parameter is of the Class type from the UML Metamodel. The UML Template Parameter has the property “Parametered Element“ of the UML Template Parameter. The metamodel type “Class“ is taken from the “UML Standard profile/UML 2 Metamodel” |
Type variable name | Mapped to the UML Class name. This UML Class is “Parametered Element“ |
Type bounds | If a bound type is a Java class, it is mapped to the General class of the “Parametered Element“. If a bound type is a Java interface, than it is mapped to the Realized Interface. |
Example
Java source code
public class Test <E extends Cloneable> { E attribute; }
In this example, the Template Parameter “E” is a subtype of the Cloneable class (e.g. “java.util.Cloneable“). “E” is used to type the “Test” public class attribute.