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

5.5.4 Class variable

Explanation

A public class variable (static field) is mapped to a COBOL property method (factory).

Expansion format

METHOD-ID. GET PROPERTY property-name.
    ...
LINKAGE SECTION.
01 property-value data-description-entry.
PROCEDURE DIVISION RETURNING property-value.
    ...
END METHOD property-name.
METHOD-ID. SET PROPERTY property-name.
    ...
LINKAGE SECTION.
01 property-value data-description-entry
PROCEDURE DIVISION USING property-value.
    ...
END METHOD property-name.

Generation rules

  1. The property name is used to identify the property. The class user can identify the property with the property name.

  2. A property name is generated according to the following rules:

    JF-JavaFieldName[-nn]
    • "JF-" is followed by a Java field name in uppercase.

    • If the property name has already been assigned, the second and subsequent property names are each suffixed with a hyphen "-" followed by a two-digit number (01 to 99) to prevent name duplication. (see "5.8 Numbering Names".)

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

  3. When FINAL is specified, no property method with the SET specification is generated.

  4. The property value is a parameter used to transfer a property value. The data description entry expands the COBOL description entry corresponding to the Java field attribute. See "5.5.1 Data types" for the correspondence of data types.

Generation rules

The property method corresponding to the class variable out (static final field) of the java.lang.System class is generated as shown below:

METHOD-ID. GET PROPERTY JF-OUT.                                [1]
    ...
LINKAGE SECTION.
01  GET-VALUE  OBJECT REFERENCE J-PRINTSTREAM.                 [2]
PROCEDURE DIVISION RETURNING GET-VALUE.
    ...
END METHOD JF-OUT.
  1. The property name is generated by adding "OUT", which is the uppercase of the Java field name, to "JF-".

  2. "out" is mapped to J-PRINTSTREAM (internal class name of java-io-PrintStream) because its attribute is java.io.PrintStream.

Supplement

When a property name is generated from a field name, a number is assigned to secure the uniqueness of the name. The class browser can be used to check the correspondence between fields and properties.