Top
NetCOBOL V11.0 J Adapter Class GeneratorUser's Guide
FUJITSU Software

3.1.5 Reducing the Size of Adapter Class

The adapter class source generated by the J adapter class generator may be simply compiled and linked before it is used.

Since, however, the adapter source class can include class files, which are not used by the applications, there might be cases where the size of the DLL file of the adapter class is significantly larger than necessary. In a case like this, the size of the adapter class can be reduced by the following methods:

3.1.5.1 Specifying the Constructor/Method/Field

When the constructors, methods, and fields that are used in the application are known, the number of the adapter classes generated can be reduced by specifying them.

The J adapter class generator generates only the adapter classes that are required by the specified constructors/methods/fields.

Refer to -r option, -gc option, -gm option, -gf option and "Class class-name/interface-name" parameters for details of the procedure of specifying the constructor/method/field.

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)"

3.1.5.2 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.

Note

  • 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.

  ...
REPOSITORY.
    CLASS J-OBJECT AS "java-lang-Object"
  ...
LINKAGE SECTION.
01 P1-OUTPUTSTREAM OBJECT REFERENCE J-OBJECT.
  ...