Identifying and referencing a class

An external-class-name is used to identify and reference a given class from outside the class definition that defines the class.

The external class-name is determined by using the contents of external-class-name-1, external-class-name-2, or class-name-1 (as specified in the repository paragraph of a class), as described below:

  1. external-class-name-1 and external-class-name-2 are used directly, without translation. They are processed in a case-sensitive manner.
  2. class-name-1 is used if external-class-name-1 or java-array-class-reference is not specified. To create an external name that identifies the class and conforms to Java™ rules of formation, class-name-1 is processed as follows:
    • The name is converted to uppercase.
    • Hyphens are translated to zero.
    • Underscores are not translated.
    • If the first character of the name is a digit, it is converted as follows:
      • Digits 1 though 9 are changed to A through I.
      • 0 is changed to J.

The class can be implemented in Java or COBOL.

When referencing a class that is part of a Java package, external-class-name-1 must be specified and must give the fully qualified Java class-name.

For example, the repository entry


Repository.
    Class JavaException is "java.lang.Exception"

defines local class-name JavaException for referring to the fully qualified external-class-name "java.lang.Exception."

When defining a COBOL class that is to be part of a Java package, specify an entry in the repository paragraph of that class itself, giving the full Java package-qualified name as the external class-name.