Fujitsu J Adapter Class Generator Portable Generator User Manual


 
24 Chapter 3. Developing Programs
An example of generating a Date class object is shown below:
...
REPOSITORY.
CLASS J-Date AS "java-util-Date"
...
WORKING-STORAGE SECTION
01 anDate OBJECT REFERENCE J-Date.
...
PROCEDURE DIVISION.
...
INVOKE J-Date "Create-Date-01" RETURNING anDate.
...
Note:
Since the adapter class name is very long, it is recommended that an alias be
assigned by specifying AS in the REPOSITORY paragraph.
Invoking a Method
Invoke an instance method by invoking the corresponding adapter class object
method. The method name is the same as that of Java. However, if more than one
method is defined with the same name, append a numeric suffix to distinguish them
(see "
Class method"
and
"Instance method
").
An example of invoking the getTime method of the Date class is shown below:
...
REPOSITORY.
CLASS J-Date AS "java-util-Date"
...
WORKING-STORAGE SECTION
01 anDate OBJECT REFERENCE J-Date.
01 currentTime PIC S9(9) COMP-5.
...
PROCEDURE DIVISION.
...
INVOKE anDate "getTime" RETURNING currentTime.
...
Manipulating a Variable
Manipulate a variable through the corresponding adapter class property. The
property name is a Java field name with the prefix "
JF-
". However, if more than one
field is defined with the same name, append a numeric suffix to distinguish them
(see "
Class variable
" and "
Instance variable
").