About this task
To
have classes in your Java design
use a JavaAnnotation:
Procedure
- Open
your IBM® Rational® Rhapsody® project
in Java.
- On a diagram (for example, an object model
diagram), drag your JavaAnnotation from the browser onto your diagram.
Notice that from a model perspective, the JavaAnnotation is shown
with two stereotypes.
- Create
a class on your diagram that represents
a user-defined Java class in
the system that wants to use the JavaAnnotation.
- Draw a dependency from your class to your
JavaAnnotation Your diagram resembles something like the following
figure:
- Double-click
the Dependency link. The Features
window opens.
- On the General tab,
from the Stereotype list, select AnnotationUsage
in PredefinedTypesJava.
Using
this stereotype ensures that the code is generated correctly. Note: AnnotationUsage displays in the Stereotype box.
- Click OK.
Your
diagram resembles something like the following figure:
Results
The following figure shows
how the annotation
is used within the Java class: