EGL Reference Guide for iSeries
The EGL generator applies the following rules to alias Java wrapper
names:
- If the EGL name is all uppercase, convert it to lowercase.
- If the name is a class name or a method name, make the first character
uppercase. (For example, the getter method for x is
getX() not getx().)
- Delete every underscore (_) and hyphen (-). (Hyphens are valid in
EGL names if you use VisualAge Generator compatibility mode.) If a
letter follows the underscore or hyphen, change that character to
uppercase.
- If the name is a qualified name that uses a period (.) as a
separator, replace every period with a low line, and add a low line at the
beginning of the name.
- If the name contains a dollar sign ($), replace the dollar sign with two
low lines and add a low line at the beginning of the name.
- If a name is a Java keyword, add a low line at the beginning of the
name.
- If the name is * (an asterisk, which represents a filler item),
rename the first asterisk Filler1, the second asterisk
Filler2, and so forth.
In addition, special rules apply to Java wrapper class names for program
wrappers, record wrappers, and substructured array items. The remaining
sections discuss these rules and give an example. In general, if naming
conflicts exist between fields within a generated wrapper class, the qualified
name is used to determine the class and variable names. If the conflict
is still not resolved, an exception is thrown at generation time.
Record parameter wrappers are named by using the above rules applied to the
type definition name. If the record wrapper class name conflicts with
the program class name or the program wrapper class name, Record is
added at the end of the record wrapper class name.
The rules for variable names are as follows:
- The record parameter variable is named using above rules applied to the
parameter name. Therefore, the get() and set()
methods contain these names rather than the class name.
- The get and set methods are named get or
set followed by the parameter name with the above rules
applied.
The rules for substructured array items class names are as follows:
- The substructured array item becomes an inner class of the record wrapper
class, and the class name is derived by applying the above rules to the item
name. If this class name conflicts with the containing record class
name, Structure is appended to the item class name.
- If any item class names conflict with each other, the qualified item names
are used.
The rules for get and set method names are as
follows:
- The methods are named get or set followed by the
item name with the above rules applied.
- If any item names conflict with each other, the qualified item names are
used.
The rules for substructured array items class names are as follows:
- The substructured array item becomes an inner class of the wrapper class
generated for the containing substructured array item , and the class name is
derived by applying the above rules to the item name.
- If this class name conflicts with the containing substructured array item
class name, Structure is appended to the item class name.
The rules for get and set method names are as
follows:
- The methods are named get or set followed by the
item name with the above rules applied.
- If any item names conflict with each other, the qualified item names are
used.
The following sample program and generated output show what should be
expected during wrapper generation:
Program WrapperAlias(param1 RecordA)
end
Record RecordA type basicRecord
10 itemA CHAR(10)[1];
10 item_b CHAR(10)[1];
10 item$C CHAR(10)[1];
10 static CHAR(10)[1];
10 itemC CHAR(20)[1];
15 item CHAR(10)[1];
15 itemD CHAR(10)[1];
10 arrayItem CHAR(20)[5];
15 innerItem1 CHAR(10)[1];
15 innerItem2 CHAR(10)[1];
end
Names of generated output
|
Output
| Name
|
Program wrapper class
| WrapperaliasWrapper, containing a field param1, which
is an instance of the record wrapper class RecordA
|
Parameter wrapper classes
| RecordA, accessible through the following methods:
- getItemA (from itemA)
- getItemB (from the first item-b)
- get_Item__C (from item$C)
- get_Static (from static)
- get_ItemC_itemB (from itemB in itemC)
- getItemD (from itemD)
- getArrayItem (from arrayItem)
ArrayItem is an inner class of RecordA that contains
fields that can be accessed through getInnerItem1 and
getInnerItem2.
|
Related concepts
Compatibility with VisualAge Generator
Java wrapper
Name aliasing
Related tasks
Generating Java wrappers
Related reference
How names are aliased
Java wrapper classes
Naming conventions
Output of Java wrapper generation
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.