Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Mastering UML with Rational Rose 2002.pdf
Скачиваний:
137
Добавлен:
02.05.2014
Размер:
9.68 Mб
Скачать

Chapter 14: Java Code Generation and Reverse Engineering

Native

Includes a native modifier in the operation.

False

Synchronized

Includes a synchronized modifier in the operation.

False

As with attributes, you can set the values of these properties using the Java specification window. Figure 14.10 shows the Java specification window for an operation.

Using this window, you can also set the operation visibility (public, private, protected, or package), set the operation return type, set the operation arguments, or list the exceptions that the operation will throw.

Figure 14.10: Setting operation properties through the Java Method Specification window

Module Properties

The module specification and body properties are those properties that are related to the files you will generate from Rose. These properties give you the ability to decide whether or not to include a copyright notice in the file and whether or not to list any configuration management strings to be generated in the code.

There are three places to set these properties. To set them for all files, select Tools → Options, then click the Java tab and select Module Specification or Module Body from the drop−down list box. To set them for only one file, select the Java tab on the standard component specification window or open the Java component specification window and edit the properties there.

Table 14.6 lists the code−generation properties for module specifications, their purposes, and their default values.

Table 14.6: Java Module Specification Properties

Property

Purpose

Default

CMIdentification

Specifies a user−defined configuration management

<blank>

 

identification string.

 

CopyrightNotice

Specifies a user−defined copyright string to include in

<blank>

 

the code as a comment.

 

Using the Java Component Specification window, as shown in Figure 14.11, you can set these properties. You can also list any Java import statements you would like to include in the generated code.

460

Chapter 14: Java Code Generation and Reverse Engineering

Figure 14.11: Setting component properties through the Java Component Specification window

You can also set code−generation properties for a module body in Java. The available properties are CMIdentification and CopyrightNotice, as described in Table 14.6.

Role Properties

Role properties are the Java code−generation properties that affect the code generated for relationships. Using these properties, you can set the container class to be used for the attribute and change other specifics of the generated code for a role.

As with most of the other property sets, there are three places to set these properties. To set them for all relationships, select Tools → Options, then click the Java tab and select Role from the drop−down list box. To set them for a single relationship, open the relationship specification. On the Java tab of the relationship specification window, you can change the properties for that relationship.

Table 14.7 lists the role properties, their purposes, and their default values.

Table 14.7: Java Role Properties

Property

Purpose

Default

ContainerClass

Specifies the container class to use if the relationship's

<blank>

 

multiplicity is greater than one.

 

InitialValue

Specifies the default value for the attribute.

<blank>

Final

Includes a final modifier in the attribute.

False

Transient

Includes a transient modifier in the attribute.

False

Volatile

Includes a volatile modifier in the attribute.

False

PropertyType

Specifies the property type for a Java Bean.

Not a Property

IndividualChangeMgt

Specifies whether or not the Java Bean gets its own

False

 

registration mechanism.

 

Read/Write (98i)

Sets whether or not Rose will generate a Get and/or a

Read & Write

 

Set method.

 

GenerateFullyQualifiedTypes

 

False

 

 

 

461