beautypg.com

Reducing the size of adapter class, Specifying the constructor/method/field – FUJITSU J Adapter Class Generator User Manual

Page 20

background image

20 Chapter 3. Developing Programs

Therefore, an adapter class cannot be generated normally without these class files.

These class files may not be available depending on the environment. In this case,

to create an adapter class normally, dummy class files having these file names must

be prepared.
Prepare a dummy class file as follows:
1. Create a folder corresponding to the package name. For package name

aaa.bbb.ccc, for instance, create a folder with name aaa\bbb\ccc.

2. Create a Java source program satisfying the following. Assign this file the name

"ClassName.java".

package PackageName;
public class ClassName
{}

3. Compile the source program with the Java compiler.

c:\> javac FolderName\ClassName.java

4. Enter the java2cob command.

c:\> java2cob PackageName.ClassName

Note: If a class file is referred to, but does not exist when attempting to generate

an adapter class, processing is terminated with message "

Class information was not

found. Generation was interrupted

."

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:
• Specifying the constructor/method/field
• Specifying the -om option or the "Option ReduceClass" parameter

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.