Acceleo 3 provides an automatic system in order to migrate an existing Acceleo 2 project into an Acceleo 3 project.
In order to launch an automatic migration from an Acceleo 2 project, right click on this project and select the Acceleo menu, then select "Convert to Acceleo MTL Projects...", finally a wizard will appear to configure the migration.
Acceleo 2 Expression
|
Acceleo 3 Expression (OCL)
|
<%x.length%>
|
[x.size()/]
|
<%x.toUpperCase%>
|
[x.toUpper()/]
|
<%x.toLowerCase%>
|
[x.toLower()/]
|
<%x.toU1Case%>
|
[x.toUpperFirst()/]
|
<%x.toL1Case%>
|
[x.toLowerFirst()/]
|
<%x.substring(1, 3)%>
|
[x.substring(2, 3)/]
|
<%x.substring(1)%>
|
[x.substring(2)/]
|
<%x.replaceAll("test", "replaced")%>
|
[x.replaceAll('test', 'replaced')/]
|
<%x.replaceAll("\w", "$0")%>
|
[x.replaceAll('\\w', '$0')/]
|
<%x.replaceFirst("test", "replaced")%>
|
[x.replace('test', 'replaced')/]
|
<%x.replaceFirst("\w", "$0")%>
|
[x.replace('\\w', '$0')/]
|
<%x.trim%>
|
[x.trim()/]
|
<%x.startsWith(y)%>
|
[x.startsWith(y)/]
|
<%x.endsWith(y)%>
|
[x.endsWith(y)/]
|
<%x.equalsIgnoreCase(y)%>
|
[x.equalsIgnoreCase(y)/]
|
<%x.matches(y)%>
|
[x.matches(y)/]
|
<%x.charAt(4)%>
|
[x.substring(5, 5)/]
|
<%x.indexOf(y)%>
|
[x.index(y)/]
|
<%x.indexOf(y, 4)%>
|
[x.substring(5, x.size()).index(y) + 4/]
|
<%x.lastIndexOf(y)%>
|
[x.lastIndex(y)/]
|
<%x.lastIndexOf(y, 4)%>
|
[x.substring(5, x.size()).lastIndex(y) + 4/]
|
<%x.split(y)%>
|
No direct equivalent, use String::tokenize(String)
|
<%x.indentSpace%>
|
\r|\n', '$0 ')/]
|
<%x.indentTab%>
|
\r|\n', '$0\t')/]
|
Acceleo 2 Expression
|
Acceleo 3 Expression (OCL)
|
<%eObject.adapt("EObject")%>
|
[eObject/]
|
<%eObject.adapt("ENodeList")%>
|
[if (eObject.oclIsUndefined())][Sequence{}/][else][Sequence{eObject}/][/if]
|
<%eObject.adapt("String")%>
|
[if (eObject.oclIsUndefined())][/][else][eObject.toString()/][/if]
|
<%eObject.adapt("Boolean")%>
|
[not eObject.oclIsUndefined()/]
|
<%eObject.adapt("int")%>
|
[eObject->size()/]
|
<%eObject.adapt("double")%>
|
[eObject->size().toString().toReal()/]
|
<%eObject.adapt("List")%>
|
[if (eObject.oclIsUndefined())][Sequence{}/][else][Sequence{eObject}/][/if]
|
<%eObject.adapt("ENode")%>
|
[eObject/]
|
<%list.adapt("EObject")%>
|
[if (list.oclIsUndefined())][null/][elseif (list->size() == 0)][else][list.at(0)/][/if]
|
<%list.adapt("ENodeList")%>
|
[if (list.oclIsUndefined())][Sequence{}/][else][list/][/if]
|
<%list.adapt("String")%>
|
[if (list.oclIsUndefined())][/][else][list.toString()/][/if]
|
<%list.adapt("Boolean")%>
|
[list->size() > 0/]
|
<%list.adapt("int")%>
|
[list->size()/]
|
<%list.adapt("double")%>
|
[list->size().toString().toReal()/]
|
<%list.adapt("List")%>
|
[if (list.oclIsUndefined())][Sequence{}/][else][list/][/if]
|
<%list.adapt("ENode")%>
|
[list/]
|
<%string.adapt("EObject")%>
|
can only return empty enodes in Acceleo 2, so migration is simply "nothing"
|
<%string.adapt("ENodeList")%>
|
[if (string.oclIsUndefined())][Sequence{}/][else][Sequence{string}/][/if]
|
<%string.adapt("String")%>
|
[string/]
|
<%string.adapt("Boolean")%>
|
[string.equalsIgnoreCase('true')/]
|
<%string.adapt("int")%>
|
[string.toInt()/]
|
<%string.adapt("double")%>
|
[string.toReal()/]
|
<%string.adapt("List")%>
|
[if (string.oclIsUndefined())][Sequence{}/][else][Sequence{string}/][/if]
|
<%string.adapt("ENode")%>
|
[string/]
|
<%boolean.adapt("EObject")%>
|
can only return empty enodes in Acceleo 2, so migration is simply "nothing"
|
<%boolean.adapt("ENodeList")%>
|
[if (boolean.oclIsUndefined())][Sequence{}/][else][Sequence{boolean}/][/if]
|
<%boolean.adapt("String")%>
|
[if (boolean.oclIsUndefined())][/][else][boolean.toString()/][/if]
|
<%boolean.adapt("Boolean")%>
|
[not boolean.oclIsUndefined() and boolean/]
|
<%boolean.adapt("int")%>
|
[if (not boolean.oclIsUndefined() and boolean)][1/][else][0/][/if]
|
<%boolean.adapt("double")%>
|
[if (not boolean.oclIsUndefined() and boolean)][1.0/][else][0.0/][/if]
|
<%boolean.adapt("List")%>
|
[if (boolean.oclIsUndefined())][Sequence{}/][else][Sequence{boolean}/][/if]
|
<%boolean.adapt("ENode")%>
|
[boolean/]
|
<%int.adapt("EObject")%>
|
can only return empty enodes in Acceleo 2, so migration is simply "nothing"
|
<%int.adapt("ENodeList")%>
|
[if (int.oclIsUndefined())][Sequence{}/][else][Sequence{int}/][/if]
|
<%int.adapt("String")%>
|
[if (int.oclIsUndefined())][/][else][int.toString()/][/if]
|
<%int.adapt("Boolean")%>
|
[not int.oclIsUndefined() and int > 0/]
|
<%int.adapt("int")%>
|
[if (int.oclIsUndefined())][0/][else][int/][/if]
|
<%int.adapt("double")%>
|
[if (int.oclIsUndefined())][0.0/][else][int.toString().toReal()/][/if]
|
<%int.adapt("List")%>
|
[if (int.oclIsUndefined())][Sequence{}/][else][Sequence{int}/][/if]
|
<%int.adapt("ENode")%>
|
[int/]
|
<%double.adapt("EObject")%>
|
can only return empty enodes in Acceleo 2, so migration is simply "nothing"
|
<%double.adapt("ENodeList")%>
|
[if (double.oclIsUndefined())][Sequence{}/][else][Sequence{double}/][/if]
|
<%double.adapt("String")%>
|
[if (double.oclIsUndefined())][/][else][double.toString()/][/if]
|
<%double.adapt("Boolean")%>
|
[not double.oclIsUndefined() and double > 0/]
|
<%double.adapt("int")%>
|
[if (double.oclIsUndefined())][0/][else][double.toString().toInt()/][/if]
|
<%double.adapt("double")%>
|
[if (double.oclIsUndefined())][0.0/][else][double/][/if]
|
<%double.adapt("List")%>
|
[if (double.oclIsUndefined())][Sequence{}/][else][Sequence{double}/][/if]
|
<%double.adapt("ENode")%>
|
[double/]
|
<%list.cast("EClass")%>
|
[list->select(not oclIsKindOf(EObject) or oclIsKindOf(EClass))/]
|
<%list.filter("EClass")%>
|
[list->select(not oclIsKindOf(EObject) or oclIsKindOf(EClass))/]
|
<%current()%>
|
[self/]
|
<%current(1)%>
|
iterator variables are named in Acceleo 3
|
<%node.debug%>
|
|
<%node.trace%>
|
|
<%node.trace("name")%>
|
|
<%nPut("key", object)%>
|
|
<%nGet("key")%>
|
|
<%nPeek%>
|
|
<%nPop%>
|
|
<%nPush%>
|
|
<%list.nMinimize%>
|
[list->asOrderedSet()->asSequence()/]
|
<%list.minimize%>
|
[list->asOrderedSet()->asSequence()/]
|
<%list.nContains(item)%>
|
[list->includes(item)/]
|
<%list.nFirst%>
|
[list->first()/]
|
<%list.nLast%>
|
[list->last()/]
|
<%list.nGet(0)%>
|
[list->at(0)/]
|
<%list.nGet(0, 1)%>
|
[list->subSequence(1, 2)/]
|
<%list.nReverse%>
|
[list->reverse()/]
|
<%list.reverse%>
|
[list->reverse()/]
|
<%list.nSize%>
|
[list->size()/]
|
<%list.nSort%>
|
[list->sortedBy(toString())/]
|
<%list.nSort(name)%>
|
[list->sortedBy(name)/]
|
<%list.sort%>
|
[list->sortedBy(toString())->asOrderedSet()->asSequence()/]
|
<%list.sort(name)%>
|
[list->sortedBy(name)->asOrderedSet()->asSequence()/]
|
<%list.sep(",")%>
|
[list->sep(',')/]
|
<%list.sepStr(",")%>
|
[list->sep(',')/]
|
<%node.toString%>
|
[node.toString()/]
|
<%eObject.until("eContainer", "EClass")%>
|
|