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.
To create a new annotation type:
- Create a class and then double-click it to access its property sheet.
- On the General tab, select AnnotationType from the Stereotype list.
- Click the Attributes tab, and add an attribute for each element of the annotation type.
- Click OK to return to the diagram. The annotation type will be represented as follows:
- Click OK to return to the diagram. The annotation type will be represented as follows:
To add an annotation to a classifier or other object:
- Double-click a class to open its property sheet.
- Click on the Java tab.
- Enter the annotation type name (preceded by an ampersand) and associated values in the Annotations field.
- 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.
|
|