Java Reference
In-Depth Information
14.1.15 Xtend Language
The Xtend language is commonly used with Xpand templates to provide reusable
operations and simple expressions by extending the underlying metamodels.
Xtend is based on the expression language covered in the previous section and is
also used for model transformation definition. We limit our use of Xtend in the
scope of this topic to its use in Xpand templates because we rely on the QVT
OML for model transformation.
Xtend files have an .ext file extension and corresponding editor in Eclipse.
They are typically arranged in libraries and imported by Xpand templates using
the «EXTENSION» statement.
Xtend Syntax
The syntax for Xtend is simplistic because most of an extension file's content is
made up of the underlying expression language syntax.
Import
The import keyword is used at the top of a file and indicates the name space of
different types used within the extension file. As usual, double colon ( :: ) char-
acters delimit elements in the namespace, and a semicolon ends the statement.
For example, the following import statement imports our mindmap model
namespace.
import mindmap;
No support exists for wildcard or static imports in Xtend, so the following
examples are incorrect:
import org::eclipse::*; // incorrect
import mindmap::Map; // also incorrect
Extension Import
It is possible to import another extension file using the «EXTENSION» keyword
at the top of the file. Again, fully qualified namespace declaration is required.
Following is an example.
extension org::eclipse::mindmap::Util; // full path with no *.ext
Search WWH ::




Custom Search