UML-to-Java transformation input

The Java™ elements that the transformation transforms depends on the source UML elements and their characteristics.

The following table lists which UML elements transform into which 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 isLeaf property Java class is final if true
Class with an isAbstract property Java class is abstract if true
Class with a generalization relationship Java class extends the specified superclass
Implementation Java class implements the specified interface
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 interface with the same name and visibility
Enumeration literal Java field with the same name and visibility
Operation Java method with the same name and visibility
Operation with an isStatic property Java method is static if true
Operation with an isAbstract property Java method is abstract if true
Operation with an isLeaf property Java method is final if true
Operation with the same name as its class Java constructor
Operation with the <<create>> stereotype Java constructor
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, pointer, or reference
1 Attribute
N (N>1) Array
1..*, *, or x..y See the following table
Property Java field with the same name and visibility
Property with an isStatic property Java field is static if true
Property with an isLeaf 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
Note: Some characters, such as a space, are not valid in Java identifiers. The transformation replaces invalid characters with an underscore (_) to create a valid identifier. This replacement can cause name conflicts that prevent the transformation from generating duplicate classes and interfaces. To avoid these replacement issues, rename the elements or use the mapping feature to specify an alternate name that does not modify the source model.

The following table lists how the transformation processes parameters and properties with certain multiplicity.

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

Feedback