Convert Names

Different target platforms use different naming conventions, so you might not want to copy the names of your elements directly into the transformed models. To facilitate this requirement, the transformation templates provide a CONVERT_NAME function macro.

Another way in which you can transform a name is to remove a prefix from the original name, with the REMOVE_PREFIX macro.

CONVERT_NAME <originalName>, <originalFormat>, <targetFormat>)

This macro converts <originalName>, which is assumed to be in <originalFormat>, to <targetFormat>.

The supported formats are:

Camel Case: new words start with a capital letter except for the first word, which begins with a lower case letter; for example, myVariableTable
Pascal Case: the same as Camel Case but the first letter of the first word is upper case; for example, MyVariableTable
Spaced: words are separated by spaces; the case of letters is ignored
Underscored: words are separated by underscores; the case of letters is ignored


The original format might also specify a list of delimiters to be used. For example a value of ' _' breaks words whenever either a space or underscore is found. The target format might also use a format string that specifies the case for each word and a delimiter between them. It takes the following form:


<firstWord> controls the case of the first word (see below)
<delimiter> is the string generated between words
<otherWords> applies to all words after the first word


Both <firstWord> and <otherWords> are a sequence of two characters. The first character represents the case of the first letter of that word, and the second character represents the case of all subsequent letters. An upper case letter forces the output to upper case, a lower case letter forces the output to lower case, and any other character preserves the original case.

Example 1: To capitalize the first letter of each word and separate multiple words with a space:

  "Ht( )Ht" to output "My Variable Table"


Example 2: To generate the equivalent of Camel Case, but reverse the roles of upper and lower case; that is, all characters are upper case except for the first character of each word after the first word:

  "HT( )hT" to output "MY vARIABLE tABLE"

REMOVE_PREFIX(<originalName>, <prefixes>)

This macro removes any prefix found in <prefixes> from <originalName>. The prefixes are specified in a semi-colon separated list.

The macro is often used in conjunction with the CONVERT_NAME macro. For example, this code creates a get property name according to the options for Java:



%if genOptGenCapitalisedProperties=="T"%

$propertyName=%CONVERT_NAME($propertyName, "camel case", "pascal case")%




Acronyms are not supported when converting from Camel Case or Pascal Case