A stereotype is an annotation that you set to communicate a major decision to the EGL compiler; in most cases, to the generator invoked by the compiler. In response to the annotation, the EGL system code creates output that acts stereotypically, that is, in accordance with a pattern. The pattern differs from one stereotype to another.
Record MyCSVRecordPart type CSVRecord
{ fileName = "employ", delimiter = "," }
employeeID INT;
employeeName STRING;
salary DECIMAL(7,2);
end
The fileName field refers to a value that you make available used at generation time. That value identifies the file used at run time, and the delimiter field indicates how one value in the file is separated from the next.
Record EmployeeType type SQLRecord
{ tableNames = [["employee"]], keyItems = [employeeID] }
employeeID INT { Column = "empid" };
employeeName STRING { Column = "empname"};
salary DECIMAL(7,2) { Column = "salary"};
end
The tableNames field references a database table, and the keyItems field indicates which fields are referencing a table key.
In both the preceding examples, the word “type” is an abbreviation for “stereotype.”
Record MyCSVRecordPart {@CSVRecord {fileName = "employ", delimiter = ","}}
employeeID INT;
employeeName STRING;
salary DECIMAL(7,2);
end
Record CSVRecord type Stereotype fileName STRING; delimiter CHAR(1); ... end
Record EmployeeType type SQLRecord
{ TableNames = [["EMPLOYEE"]], KeyItems = [employeeID] }
employeeID INT { Column = "EMPID" };
employeeName STRING { Column = "EMPNAME"};
salary DECIMAL(7,2) { Column = "SALARY"};
end
The Column annotation relates the employeeID, employeeName, and salary fields with relational-database table columns; specifically, with the EMPID, EMPNAME, and SALARY columns. The SQLRecord stereotype causes the Column annotation to be available in any Record part that is defined with the stereotype.
Each classifier such as Record or Program supports zero to many stereotypes. You select from the list when you define a custom part.