Java Reference
In-Depth Information
CHAPTER 14
Xpand Template Language
From model instances, it's common to generate code, text files, reports, and so on.
Query/View/Transformation Operational Mapping Language (QVT OML) provides our
language for Model-to-Model Transformation (M2M), and we turn to Xpand to provide
for Model-to-Text Transformation (M2T). Alternative choices exist within the M2T proj-
ect, namely Java Emitter Templates (JET) and the new Model to Text Language (MTL)
component.
JET is the default M2T technology that EMF itself uses, but other projects within Eclipse
have found success and discovered advantages to using Xpand. JET borrows heavily from
Java Server Pages (JSP), but Xpand has a significantly different syntax to offer those who
might not be fond of JSP. This is not to say that JET is not worth consideration as the
default template technology in your DSL Toolkit; this topic just does not cover it.
Hopefully a future book will include details on using JET.
Xpand itself has minimal syntax and relies on the Xtend language and underlying expres-
sion language and type system to complete its syntax and semantics. Xpand also provides
aspect-oriented capabilities, which lends to its extensibility features. Invoking Xpand tem-
plates is primarily done through the EMFT Modeling Workflow (MWE) component. This
chapter covers all these topics, in addition to example code throughout to illustrate
Xpand's capabilities.
One important note about the future of Xpand is important at this point. Two versions of
Xpand exist within the Modeling project. I cover the traditional Xpand here, and a refac-
tored version will soon be available in the context of the Graphical Modeling Framework
(GMF) project. This version uses OCL and QVT OML as the expression language and
will be invoked primarily from Java or Ant files. The latter represents an attractive work-
flow alternative to MWE, particularly because QVT OML also provides Ant integration.
For now, however, let's continue our coverage of the Xpand language.
605
 
 
Search WWH ::




Custom Search