The Java Operation mapped directly to the UML Operation is done with the stereotype «JavaOperation». This stereotype is optional, so if the UML class has no stereotype Java CE treats it as a Java Operation. If no appropriate property is found in UMLOperation, modifiers are mapped into UML Property properties or to the Java language properties. The Java Operation return type is mapped to the UML Type property of the UML Parameter with the “Return“ direction kind. Java Operation parameters are mapped to the UML Parameters. The direction kind is set “In“ for “final” parameters. Note that Java parameter type modifiers are mapped to the UML specific property “Type Modifier,“ but not to the UML Multiplicity.

Operation mapping table

Java ElementUML Element
Operation declaration

UML Operation, owned by UML Class, with stereotype «JavaOperation» (optional)

Operation Name

UML Operation Name 

Operation documentation

UML Operation Documentation

Parameters list

UML Operation “Parameters” list 

Return type

Mapped to the UML Parameter type with “return“ direction kind, i.e., it resides in the UML Operation parameters list. It is a reference to the UML Classifier; its package structure and name represent the referenced Java class

Return type modifiers

Mapped to the MagicDraw specified property “Type Modifier“ 

Visibility modifierUML Operation “Visibility” property
Final modifier

UML Operation “Is Leaf“ property

Abstract modifier

UML Operation “Is Abstract“ property

Static modifier

UML Operation “Is Static“ property

Synchronized modifier

UML Operation “Concurrency“ kind “guarded”

Throws list

UML Operation “Raised Exception“ list. It is a list of references to the UML Classes; its package structure and name represent the referenced Java exception class.

Native modifier

Java Language property “Native modifier” 

Strictfp modifier

Java Language property “Strictfp modifier”

Parameter mapping table

Java ElementUML Element
Parameter declaration

UML Parameter, owned by UML Operation, with stereotype «JavaParameter» (optional) 

Parameter name

UML Parameter Name 

Parameter documentation

When used in JavaDoc preprocessing, it is mapped to the UML Parameter Documentation. If not, it is part of the UML Operation Documentation.

Return type

Mapped to the UML Type property. It is a reference to the UML Classifier; its package structure and name represent the referenced Java exception class. 

Return type modifiers

Mapped to the MagicDraw specified property “Type Modifier“ 

Final modifier

Direction kind “in“ of the UML Parameter

Examples

Java Source Code

public class MyList
{
/**
* Operation Comment
*/
public abstract void foo(final List list) throws IllegalArgumentException;
}

UML Model

Class with an operation.