Mapping of UML Elements to Source Code

The assumption is that the input model conforms to UML 2.0 standard. The PIM usually contains only interfaces containing properties and operations and an associated protocol state machine, however in most cases it will contain classes consisting of properties, operations and associated behavioral state machines.

The following tables how the mapping of some UML 2.0 elements to the target language, which is Java in this particular case (see table and ). The mapping has been implemented by the transformation JETs file and the code generator helper class.

The mapping of the UML 2.0 interface elements to Java elements is summarized in the following table.

UML2 model element Java

Package

Folder

Interface

Interface (.java file)

Generalization relationship

Interface inheritance

Interface property

Setter, getter operation

Interface operation

Operation

Parameter

Operation argument

Return parameter

Operation return type

Template parameter

Parameter for parametrization of operations

Protocol State Machine

No equivalent representation

Call Trigger

No equivalent representation

Region

No equivalent representation

State

No equivalent representation

Pseudostate (Initial state)

No equivalent representation

Transition

No equivalent representation

The mapping of the UML 2.0 class elements to Java elements is summarized in the following table.

UML2 model element Java

Package

Folder

Class

Class (.java file)

Generalization relationship

Class or interface inheritance

Association relationship

Class attribute

Class property

Class attribute

Class operation

Operation

Parameter

Operation argument

Return parameter

Operation return type

State Machine

No equivalent representation

Call Trigger

Trigger operation

Region

No equivalent representation

State

Instance of the State class (see the hierarchical state machine concept)

Pseudostate (Initial state)

Marking a particular state as an initial state (see the hierarchical state machine concept)

Transition (triggered)

Operation