Creating a JavaAnnotation type

Java 5 annotations are modeled like the classes and objects. Therefore, you need to define this type of annotation before you can use it.

About this task

To create a Java annotation type:

Procedure

  1. Open your IBM® Rational® Rhapsody® project in Java, right-click a package or class on the browser, and select Add New > Annotation Type.
  2. Type a name for your new annotation type.
  3. Double-click the annotation type. The Features window opens.
  4. On the Elements tab, add any legal JDK 5 data type, as shown in the following figure.
    1. Click <<New> and type a name for the element.
    2. Select a type from the Type list.
    3. Enter a default value if necessary.
      Note: The rows on this tab relate to annotation elements.
  5. Click OK.

Feedback