Java Reference
In-Depth Information
CHAPTER 7
Developing Model-to-Text
Transformations
Working with domain-specific languages (DSLs) in the form of their abstract syntax, con-
crete syntax, and Model-to-Model Transformations (M2M) is great, but what we typically
want to derive is a working software application, a database schema, or even some docu-
mentation from our models. This is where Model-to-Text Transformations (M2T) come
into play. We typically generate code in the form of some general-purpose programming
language such as Java, or even output HTML from our model instances.
As touched upon in Chapter 6, “Developing Model-to-Model Transformations,” consid-
erations must be made when selecting a transformation technology, both M2M and M2T.
Either or both can fulfill your needs, with some form of workflow required in the case of
the latter.
Numerous code-generation technologies are available, both within and outside Eclipse.
Within the Modeling project are several facilities for code generation from models. The
home for most of these components is the M2T project.
7.1 M2T Project
Two main components within the M2T project exist for code generation from
models: Java Emitter Templates (JET) and Xpand. JET is the traditional template
engine that was used with Eclipse Modeling Framework (EMF) and is closely
aligned with Java Server Pages (JSP). It was extracted from EMF and improved
into what's now referred to as JET2. We don't cover JET in this topic because of
space considerations. Instead, we focus on the capabilities of Xpand as a tem-
plate engine to complement our DSL Toolkit.
277
 
 
 
Search WWH ::




Custom Search