Example – FUJITSU J Adapter Class Generator User Manual

Page 21

Advertising
background image

Chapter 3. Developing Programs 21

Example:
When an application uses only the println (Object) method of the java.io.PrintStream

class, specify as follows:

C:\> java2cob -r java.io.PrintStream -gm "println(java.lang.Object)"

Specifying the -om Option or the "Option ReduceClass"

Parameter

Specifying the -om option or the "Option ReduceClass" parameter can reduce the

number of adapter classes generated. To check for parameter validity at method

invocation, the J adapter class generator generates adapter classes corresponding to

individual parameters. Thus many adapter classes are generated for one class.
When the -om option or the "Option ReduceClass" parameter is specified, all object-

type method parameters are mapped to the java-lang-Object class. This function

suppresses the generation of adapter classes corresponding to the method

parameters and thereby reduces the number of adapter classes generated.
Notes:
• When the method of the adapter class generated with the -om option or the

"Option ReduceClass" parameter specified is invoked, BY CONTENT must be

specified as an object reference parameter.

• When the -om option or the "Option ReduceClass" parameter is specified, the

object reference types of method parameters excluding the return value become

java-lang-Object and therefore the original parameter types become uncertain.

Therefore, for a parameter whose object reference type becomes java-lang-

Object, a parameter name is generated according to the following rules so that

the original type information is included in the parameter name.

Pn-ClassName

• P is followed by a parameter serial number (1 to 99).
• The hyphen "-" is followed by an external class name excluding a package name

after conversion into uppercase.

• A parameter name exceeding 30 characters is truncated after the 30th character.
Example:
When the -om option or the "Option ReduceClass" parameter is not specified,

adapter class source java-io-PrintStream.cob of the java.io.PrintStream class

becomes as shown below, and the java-io-OutputStream class is required.

...
REPOSITORY.
CLASS J-OUTPUTSTREAM AS "java-io-OutputStream"
...
LINKAGE SECTION.
01 PARA-1 OBJECT REFERENCE J-OUTPUTSTREAM.
...

When the -om option or the "Option ReduceClass" parameter is specified, the

parameter becomes the java-lang-Object type. Therefore, the java-io-OutputStream

class is not required or generated.

Advertising