Rose/Java mapping: introduction, definition of terms, страница 3

3.10  METHOD

Maps to an operation of the class.

JAVA SEMANTICS:

 [modifiers] oper_type oper_name (param_type1 param_decl1, ) [throws exception1, …] { }

modifiers = defined as follows:

public |`protected | private = export selection (implementation type is used for package visibility) of the operation.

static = Operation.Static property

abstract = Operation.Abstract property

final = Operation.Final property.

native = Operation.Native property.

synchronized = Operation.Synchronized property.

oper_type = operation return type

oper_name = operation name

param_typen = type of nth parameter.

param_decln = name of the nth parameter

exception1, … = operation exceptions

PROPERTIES

Operation Properties

·  Static (Boolean FALSE) – Indicates whether the method is static

·  Abstract (Boolean FALSE) – Indicates whether the method is abstract

·  Final (Boolean FALSE) – Indicates whether the method is final

·  Native (Boolean FALSE) – Indicates whether the method is native

·  Synchronized (Boolean FALSE) – Indicates whether the method is synchronized.

4  FORWARD ENGINEERING

4.1  Selection of Components for Forward Engineering

The basic unit of forward engineering is a component whose assigned language is Java.  Component packages, logical packages, and classes may also be selected to initiate forward engineering.

If a component package is selected all the components which derive directly or indirectly from that package are forward engineered.

If a logical package is selected all the classes which derive directly or indirectly from that package are considered.  For each class which has Java as its assigned language, its assigned component is forward engineered.

If a class whose assigned language is Java is selected its assigned component is forward engineered.  If such a class has no assigned component one is created in the Component View package. If an attempt is made to forward engineer any classes whose assigned language is not Java a warning is generated.

If an attempt is made to forward engineer any components whose assigned language is not Java a warning is generated.

4.2  Mapping Components to the File System

A Java component and its hierarchy of parent packages represent a relative path in the file system.  The package names are used as the directory names, the component name is used as the file name and "java" is used as the file extension.  During forward engineering this relative path is rooted in an absolute path in the file system.

An attempt is made to locate the topmost directory in one of the CLASSPATH entries.  If it cannot be located, a dialog is presented which allows the user to map the component to an entry in the CLASSPATH.

4.3  Creating File System Elements

If any of the directories in the path do not exist and the Project.CreateMissingDirectories property is TRUE the directories are created. 

If the target file already exists the existing file is saved as a backup before being overwritten.  The name of the backup file is identical to that of the target file except that its extension is set to "~jav".

4.4  Generating imports

Any dependency relationship whose client is the component being forward engineered and whose supplier is a component contained in a different package generates an import statement which references the supplier component.

Any dependency relationship whose client is the component being forward engineered and whose supplier is a package other than that of the componet generates an import statement which references the supplier package.

Any relationship (generalization, dependency, or association) whose client is a class being forward engineered generates an import statement which references the component in which the supplier class would be implemented if the package of the supplier component is different than that of the client class.