Traces for Xtend model transformations
create methods
In order to have simple traces in Xtend model transformations create
methods can be used:
def create constructorOrFactoryExpr aCreateTransfo(ParamType param) { // transformation expressions that are only performed if no trace for the given param was found }
To use a trace that was created during the first call of a create method for given parameters the method simply has to be called again: Both the first expression for a call to a constructor or factory method and the transformation body are only executed if no trace was found (i.e. during the first execution with the given parameters).
More information on Xtend create methods can be found in the old Xpand Documentation, a discussion in the Xtend google group, or Sven Efftinge's blog post.
Note that create methods do not support late resolving. A framework that supports late resolving of traces in Xtend was developed at SDQ.