Output of Java™ wrapper generation
The output of Java™ wrapper generation is as follows:
- A build plan, if the genProject build descriptor option is omitted
- JavaBeans™ for wrapping calls to a Java™ server program (see Java™ wrapper)
- EJB session beans under certain circumstances; for details, see the explanation of the callLink element in Linkage options part
- A results file, if genProject is omitted
- Beans for servers
- Beans for record parameters
- Beans for record array rows
The following table shows the names of the various types of generated Java™ wrapper parts:
| Part type and name | What is generated |
|---|---|
| Program named P | A class named PWrapper in PWrapper.java |
| Record named R used as a parameter or input record. | A class named R in R.java |
| Substructured area S in record R used as a parameter | A class named R.S in R.java |
| Linkage options part named L | Linkage properties file named L.properties |
- For the indicated part types, it is possible that two or more parts may exist with the same name. In that event the name of the second one will have an additional suffix, $v2. The name of the third will have a $v3 suffix, the fourth will have $v4, etc.
When you request that a program part be generated as a Java™ wrapper, EGL produces Java™ class for each of the following executables:
- The program part
- Each record that is declared as a program parameter
- A session bean, if you specify a linkage options part and a the callLink element for the generated program has a link type of ejbCall
- Is in the internal structure of one of those records
- Has at least one subordinate structure field; in other words, is substructured
- Is an array; in this case, a substructured array
- The name is converted to lowercase.
- Each hyphen or minus (-) or underscore (_) is deleted. A character that follows a hyphen or underscore is changed to uppercase.
- When the name is used as a class name or within a method name, the first character is translated back to uppercase.
If one of the parameters to the program is a record, EGL generates a wrapper class for that variable as well. If program Prog has a record parameter with a typeDef named Rec, the wrapper class for the parameter will be called Rec. If the typeDef of a parameter has the same name as the program, the wrapper class for the parameter will have a "Record" suffix.
The generator also produces a wrapper if a record parameter has an array field and the field has other field under it. This substructured array wrapper becomes an inner class of the record wrapper. In most cases, a substructured array field called AField in Rec will be wrapped by a class called Rec.AField. The record may contain two substructured array fields with the same name, in which case the field wrappers are named by using the qualified names of the fields. If the qualified name of the first AField is Top1.AField and the qualified name of the second is Top2.Middle2.AField, the classes will be named Rec.Top1$_aField and Rec.Top2$_middle2$_aField. If the name of a substructured array is the same as the name of the program, the wrapper class for substructured array will have a Structure suffix.
Methods to set and get the value of low-level fields are generated into each record wrapper and substructured array wrapper. If two low-level fields in the record or substructured array have the same name, the generator uses the qualified-name scheme described in the previous paragraph.
Additional methods are generated into wrappers for SQL record. For each field in the record, the generator creates methods to get and set its null indicator value and methods to get and set its SQL length indicator.
You can use the Javadoc™ tool to build a classname.html file once the the class has been compiled. The HTML file describes the public interfaces for the class. If you use HTML files created by Javadoc™, be sure that it is an EGL Java™ wrapper. HTML files generated from a VisualAge® Generator Java™ wrapper are different from those generated from an EGL Java™ wrapper.
Example
An example of a record part with a substructured array is as follows:
Record myRecord type basicRecord
10 MyTopStructure[3];
15 MyStructureField01 CHAR(3);
15 MyStructureField02 CHAR(3);
end
aliasWrapper.javawhere - alias
- Is the alias name, if any, that is specified in the program part. If the external name is not specified, the name of the program part is used.
recordName.javawhere - recordName
- Is the name of the record part
- If the array name is unique in the record, the inner class is
within the record class and is named as follows:
whererecordName.siName- recordName
- Is the name of the record part
- siName
- Is the name of the array
- If the array name is not unique in the record, the name of the
inner class is based on the fully qualified name of the array, with
one qualifier separated from the next by a combination of dollar sign
($) and underscore (_). For example, if the array is at the third
level of the record, the generated class is an inner class of the
record class and is named as follows:
whereTopname$_Secondname$_Siname- Topname
- Is the name of the top-level structure field
- Secondname
- Is the name of the second-level structure field
- Siname
- Is the name of the substructured-array field
If another, same-named array is immediately subordinate to the highest level of the record, the inner class is also within the record class and is named as follows:
whereTopname$_Siname- Topname
- Is the name of the highest-level structure field
- Siname
- Is the name of the substructured-array field
Finally, consider the following case: a substructured array has a name that is not unique in the record, and the array is subordinate to another substructured array whose name is not unique in the record. The class for the subordinate array is generated as an inner class of an inner class.
When you generate a Java™ wrapper, you also generate a Java™ properties file and a linkage properties file if you request that linkage options be set at run time.