Chapter 14 Working with Java


Annotations

Java annotations are a form of metadata that can be accessed by post-processing tools or at run-time to vary to behavior of the system.

PowerDesigner supports the use of the built-in Java annotations, as well as the creation of your own using a class with the AnnotationType stereotype.

Steps To create a new annotation type:

  1. Create a class and then double-click it to access its property sheet.
  2. On the General tab, select AnnotationType from the Stereotype list.
  3. Click the Attributes tab, and add an attribute for each element of the annotation type.
  4. Click OK to return to the diagram. The annotation type will be represented as follows:
  5. Click OK to return to the diagram. The annotation type will be represented as follows:

Steps To add an annotation to a classifier or other object:

  1. Double-click a class to open its property sheet.
  2. Click on the Java tab.
  3. Enter the annotation type name (preceded by an ampersand) and associated values in the Annotations field.
  4. Click OK to return to the diagram. When you generate the class, its declaration will be preceded by the annotation:

 


Copyright (C) 2005. Sybase Inc. All rights reserved.