Enterprise Architect's code templates specify the transformation from UML elements to the various parts of a given programming language. The templates are written as plain text with a syntax that shares some aspects of both mark-up languages and scripting languages. A simple example of a template used by Enterprise Architect is the 'Class template'. It is used to generate source code from a UML Class:
%ClassNotes%
%ClassDeclaration%
%ClassBody%
The above template simply refers to three other templates, namely ClassNotes, ClassDeclaration and ClassBody. The enclosing percent (%) signs indicate a macro. Code Templates consist of various types of macros, each resulting in a substitution in the generated output. For a language such as C++, the result of processing the above template might be:
/**
* This is an example class note generated using code templates
* @author Sparx Systems
*/
class ClassA : public ClassB
{
...
}
See Also