Fujitsu J Adapter Class Generator Portable Generator User Manual


 
66 Chapter 5. Adapter Class Reference
Expansion format
CLASS-ID. internal-class-1 AS "external-class-name" INHERITS internal-
class-name-2.
...
FACTORY.
...
<<NEW-ARRAY method>>
END FACTORY.
OBJECT.
...
<<GET-ARRAY-LENGTH method>>
<<GET-ARRAY-ELEMENT method>>
<<SET-ARRAY-ELEMENT 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:
JA-NumberOfDimensions-ElementTypeName
- "JA-" is followed by the number of dimensions (1 to 9) and element type
name with a hyphen "-" inserted in between them.
- An element type name is generated depending on the type in the following
format:
- Object: External class name of the adapter class corresponding to the Java
class (See "
Class and interface
.")
- Basic type: Java keyword representing a type (boolean, byte, char, short,
int, long, float, or double)
- An external class name exceeding 160 characters is truncated after the
160th character.
4. The following methods are generated in the factory or method definition:
Method name Type Function
NEW-ARRAY Factory Generates an array object.
GET-ARRAY-LENGTH Object Obtains the number of elements of an array.
GET-ARRAY-ELEMENT Object Fetches a value from an array element.
SET-ARRAY-ELEMENT Object Sets a value in an array element.
5. An n-dimensional array is handled as a one-dimensional array having an n-1-
dimensional array as an element. Therefore, for n-dimensional array, n adapter
classes (JA-n-XYZ, JA-(n-1)-XYZ, ..., JA-1-XYZ) are generated. JA-n-XYZ is a
one-dimensional array having JA-(n-1)-XYZ as an element.
Generation example
The adapter class for java.lang.String[] is generated as shown below: