Generation example, Supplement – FUJITSU J Adapter Class Generator User Manual

Page 55

Advertising
background image

Chapter 5. Adapter Class Reference 55

6. When an exception is declared for the constructor, the RAISING specification is

generated.

Generation example
The factory method corresponding to constructor Date() of the java.util.Date class is

generated as shown below:

METHOD-ID. CREATE-01 AS "Create-Date-01". [1]
...
LINKAGE SECTION.
01 CREATED-OBJECT OBJECT REFERENCE SELF.
PROCEDURE DIVISION RETURNING CREATED-OBJECT.
...
END METHOD CREATE-01.

1. The factory method of java-util-Date is generated with name "Create-Date"

followed by a number.
The factory method corresponding to the constructor Date (long) of the

java.sql.Date class (java.util.Date subclass) is generated as shown below:

METHOD-ID. CREATE-08 AS "Create-Date-08". [1]
...
LINKAGE SECTION.
01 CREATED-OBJECT OBJECT REFERENCE SELF.
01 PARA-1 PIC S9(18) COMP-5.
PROCEDURE DIVISION USING PARA-1 RETURNING CREATED-OBJECT.
...
END METHOD CREATE-08.

2. The factory method of java-sql-Date is also generated with name "Create-Date"

followed by a number. To prevent name duplication, serial numbers including

java-util-Date factory methods are assigned.

Supplement
A factory method name is generated from a constructor, a number is assigned to the

name to secure the uniqueness of the name. The class browser or method name

cross-reference list file can be used to check the correspondence between

constructors and factory methods. In the case of class browser, it can be identified

from the parameter that appears during method selection. In the case of method

name cross-reference list file, it can be identified from the type of argument of the

constructor.

Advertising