Generation example, Supplement, Java-lang-string class – FUJITSU J Adapter Class Generator User Manual

Page 61: New-string-x method (factory method), Explanation, Syntax

Advertising
background image

Chapter 5. Adapter Class Reference 61

Generation example
The object method corresponding to instance method getTime() of the java.util.Date

class is generated as shown below:

METHOD-ID. JM-GETTIME AS "getTime". [1]
...
LINKAGE SECTION.
01 RTN-VALUE PIC S9(18) COMP-5.
PROCEDURE DIVISION RETURNING RTN-VALUE.
...
END METHOD JM-GETTIME.

1. Since there is only one method with name "getTime," a method with name

"getTime" is generated with no number assigned.

Supplement
When a COBOL method name is generated from a Java method name, a number is

assigned 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 Java

methods and COBOL 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.

java-lang-String class

Like other classes, the java.lang.String class is mapped to the java-lang-String class.

However, the java-lang-String class has the following methods for referencing or

setting character string data, in addition to the methods defined in the

java.lang.String class:

Method name

Type

Function

NEW-STRING-X

Factory

Generates a String object having the specified
alphanumeric data item as the initial value.

NEW-STRING-N

Factory

Generates a String object having the specified
national data item as the initial value.

GET-STRING-X

Object

Fetches the character string as an alphanumeric data
item.

GET-STRING-N

Object

Fetches the character string as a national data item.

GET-STRING-LENGTH-X Object Determines alphanumeric data item length.
GET-STRING-LENGTH-N Object Determines national data item length.

NEW-STRING-X method (factory method)

Explanation
This method generates a String object having the character string specified for the

alphanumeric data item as an initial value.
Syntax
INVOKE

class-name

"NEW-STRING-X" USING

initialValue

RETURNING

createdObject

Advertising