beautypg.com

Example – FUJITSU J Adapter Class Generator User Manual

Page 70

background image

70 Chapter 5. Adapter Class Reference

Name that is always unique according to generation rules

A class name is generated from a class name or interface name qualified by a Java

package name. Since the qualified name is unique, the COBOL name generated

from it is always unique. The same applies to an array class name.
Thus, no class names and array class names are numbered.

Name that needs to be unique between super

classes/subclasses

A factory method name corresponding a constructor is generated from a class name

that is not qualified by a package name. Factory method names including methods

inherited from the super classes must all be unique to one another. However,

names conflict when:
• Super classes have a same name qualified by different packages.
• Two or more constructors are defined for one class.
In this case, the J adapter class generator assigns numbers to the methods with a

same name according to the following rules:
1. Number 01 is assigned to the name that appears first and then serial numbers

are assigned in ascending order to the subsequent names.

2. The above rule is applied to names in order from the constructor defined in the

super class. When two or more constructors are defined for one class, the rule

is applied to them in order they are defined.

Example
The factory methods corresponding to the constructor of the java.util.Date class and

java.sql.Date class (subclass of the java.util.Date class) are assigned names as

shown below:

Java constructor

COBOL factory method

Date() Create-Date-01
Date(int, int, int)

Create-Date-02

Date(int, int, int, int, int)

Create-Date-03

Date(int, int, int, int, int,
int)

Create-Date-04

Date(long) Create-Date-05

java.util.Date class

Date(String)

ava-util-Date class

Create-Date-06

Date(int, int, int)

Create-Date-07

java.sql.Date class

Date(long)

java-sql-Date class

Create-Date-08

Name that needs to be unique within an entire run unit

Java method names are normally used as they are in COBOL. However, Java

permits multiple methods with a same name to be defined if they have different

parameters. In this case, numbers are assigned to COBOL method names for

identification. However, to take advantage of polymorphism (diversification) that is

the characteristics of object-oriented programming, methods having the same name

and parameter are always assigned the same name. This correspondence

relationship must be consistent within the run unit of the COBOL program that uses