Modelio Java Architect allows you to create Stereotypes that represent java annotations.
Java Architect represents Java annotations by default with a "JavaAnnotation" note.
Creating an annotation stereotype
-
Go to the "
LocalModule" module
-
Create a
profile
-
Create a
stereotype .
In the stereotype dialog box:
-
Give as name the simple name of the java annotation you want to represent
-
Select as metaclass the metaclass the java annotation applies to.
-
For a java annotation that applies to types, choose
Standard.Classifier
. -
For a java annotation that applies to members, choose
Standard.StructuralFeature
. -
For a java annotation that applies to parameters, choose
Standard.Parameter
.
-
-
you may choose an icon and an image
-
![]() |
If the java annotation applies to many targets you may have to create many Stereotypes. |
Java annotation mappings
Once the stereotype is created the java annotation type is represented in Modelio by many elements:
-
a "
JavaAnnotation" stereotyped class
-
The
stereotype(s) you created
Using the stereotype
You may either :
-
Add the annotation in the generated file then reverse it.
The stereotype will be applied automatically.
-
apply the created stereotype on an element then generate the Java code.
In this case you will have to add manually an ElementImport toward the "JavaAnnotation" stereotyped class.
Limitations
-
Java Architect does not support java annotations with the same simple name in different packages.
-
When applying manually a java annotation stereotype, the generated java file misses an import clause toward the java annotation type. It is recommended instead to add the java annotation in the java file first before reversing it.