Message-ID: <2092150418.87705.1397749181452.JavaMail.email@example.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_87704_1136794590.1397749181452" ------=_Part_87704_1136794590.1397749181452 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Access to models generated with the Eclipse Model= ing Framework is easy in Groovy with the help of Groovy Beans and GPath= .=20
As an example we use the EMF tutorial. This model contains three= classes Book, Writer and Library and an enumeration BookCategory. From thi= s model EMF generates Java code. There are two special classes: a package c= lass and a factory class. We need the package class for reading the model. = We have to instantiate it and load a file with data as following.=20 =20
Now we are able to query the model using standard Groovy. For example=20 =20
prints out all books. We can print out all the books with less than 240 = pages with the following statement.=20 =20
All the objects in an EMF model are constructed with methods from a fact= ory (LibraryFactory in this example). The Groovy EMF Builde= r provides an interface for constructing models and model elements. It = takes an EMF factory as an argument. In the following snippet three objects= are created in the model: a Library, a Writer and a Book.=20 =20
The braces indicate the containment relationships writers and books of t=
he class Library.
See the homepage of the Groovy EMF = Builder for further details.