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

5.5.2 Class and interface

Explanation

Public classes and interface are mapped to COBOL classes. The inheritance relationships of adapter classes are the same as those of the corresponding Java classes. Note that the following Java class inherits no other classes or interfaces but the adapter classes generated inherit JF-JAVA-BASE.

Similarly, the following interface inherits no other classes or interfaces but the adapter classes generated inherit java.lang.Object.

Expansion format

CLASS-ID. internal-class-name-1 AS "external-class-name" INHERITS internal-class-name-2.
    ...
FACTORY.
    ...
  <<Factory method corresponding to a constructor>>
  <<Property method corresponding to a class variable>>
  <<Factory method corresponding to a class method>>
END FACTORY.
OBJECT.
    ...
  <<Property method corresponding to an instance variable>>
  <<Object method corresponding to an instance method>>
END OBJECT.
END CLASS internal-class-name-1.

Generation rules

  1. Internal class names 1 and 2 are internally used by the J adapter class generator and are not viewed from the class user.

  2. The external class name is used to identify the class. The class user can identify the class with the external class name.

  3. An external class name is generated according to the following rules:

    [PackageName-[PackageName-...]] ClassName/InterfaceName
    • Period "." used in the class name or interface name fully qualified with a package name is replaced with hyphen "-".

    • A name exceeding 160 characters is truncated after the 160th character.

  4. The following three methods are generated in the FACTORY definition:

    • Factory method corresponding to a constructor

    • Property method corresponding to a class variable

    • Factory method corresponding to a class method

  5. The following two methods are generated in the OBJECT definition:

    • Property method corresponding to an instance variable

    • Object method corresponding to an instance method

Generation example

The adapter class of the java.util.Date class is generated as shown below:

CLASS-ID. J-DATE AS "java-util-Date" INHERITS J-OBJECT.    [1]
    ...
REPOSITORY.
    CLASS J-OBJECT AS "java-lang-Object".                  [2]
    ...
END CLASS J-DATE.
  1. The name of the adapter class of the java.util.Date class is java-util-Date.

  2. The external name of J-OBJECT in the INHERIT clause is java-lang-Object. That is, java-util-Date inherits java-lang-Object.

Note

NetCOBOL does not distinguish between uppercase and lowercase letters of a class name. Therefore, class names whose external class names are different only in uppercase and lowercase letters cannot be used concurrently.

Supplement

When the adapter class of java.lang.String is generated, the public method defined in the java.lang.String class is generated. In addition, a method for referencing or setting character string data is generated. (see "5.6 java-lang-String class".)