Integrations (PTC products, 3rd party products and code) > Code integration (Ada, ARINC 653, C, C#, C++, IDL, Java, SQL and VB) > Transformation Development Kit (TDK) > Customizing an ACS Code Generator DLL > Customizing a TDK code generation transformation patterns model - current TDK models > Changing code generation definition in a TDK code generation transformation patterns model > Creating alternative 4G generation classes in a TDK code generation transformation patterns model
  
Creating alternative 4G generation classes in a TDK code generation transformation patterns model
You can create your own 4G Generation Classes that are considered as candidates before the provided 4G Generation Classes are considered.
For more information about 4G Generation Classes, see Definition of how code is generated - 4G generation classes (TDK).
* 
Do not change the provided 4G Generation Classes - if you do so, your changes will be lost should you update the TDK Code Generation Transformation Patterns model with improvements provided in a future release of Modeler.
To create an alternative 4G generation class:
1. Create a new Package in the TDK model that is not scoped to the Generator or TDK Generator Framework packages.
2. In the Package you created, create a Class Diagram to show your 4G Generation Classes.
3. On the Class Diagram, create a Class, and name it as required.
Alternatively, if the 4G Generation Class you want to create is similar to an existing 4G Generation Class, create a clone of that Class in the Package you created, and rename it as required.
4. Apply the 4GGen stereotype to the Class you created. How?
5. Add to the Class Diagram you created, the Meta Class for which your 4G Generation Class will define code generation.
The provided Meta Classes reside in the Generator::Structure package.
6. Map your 4G Generation Class to the Meta Class through a Dependency of type Dependency:
a. On the Class Diagram toolbar, click the Dependency button.
b. Click your 4G Generation Class, and then click the Meta Class.
7. For the 4G Generation Classes that map to the Meta Class you are using, identify the 4G Generation Class that is the first candidate of the chain of responsibility.
Each of the provided chains of responsibility starts with an appropriately named Attach Point 4G Generation Class that resides in the Generator::Model2Text::CustomizationAttachPoints package. For example, the QStudioAttribute class starts the chain of responsibility for generating Attributes.
If required, you can determine the first candidate as follows:
a. Open the Mapping class diagram in the Generator::Structure package and identify the 4G Generation Classes that map to the Meta Class you are working with.
b. Show the chain of responsibility on the diagram - for each of the 4G Generation Classes that map to the Meta Class, right-click the Class, point to Populate, and then click Dependents.
c. Identify the 4G Generation Class that is at the beginning of the chain of responsibility, that is, the Class that has an outgoing 4G Evaluation Order dependency, but no incoming 4G Evaluation Order dependency.
8. Add the 4G Generation Class that is at the beginning of the chain of responsibility to the Class Diagram you created.
9. Add your 4G Generation Class to the beginning of the chain of responsibility:
a. On the Class Diagram toolbar, click the Dependency button.
b. Click your 4G Generation Class, and then click the 4G Generation Class that is currently at the beginning of the chain of responsibility.
c. Apply the 4GEvalOrder stereotype to the Dependency. How?
10. On your 4G Generation Class, define a When operation that specifies the criteria for when your 4G Generation Class is used. Set the Data Usage of the When operation to On Class.
11. Create and define the required Rules and Operations on the 4G Generation Class you created. Ensure that the Data Usage of the Operations is set to On Instance:
Tell me more…
Tell me more…
12. If you want to inherit Rules and Operations from any 4G Business Classes, link your 4G Generation Class to those 4G Business Classes through Dependencies of type Abstraction.
13. If you want to inherit Rules and Operations from any 4G Generation Classes, link your 4G Generation Class to those 4G Generation Classes through Generalizations.