O'Reilly logo

Implementing Domain-Specific Languages with Xtext and Xtend by Lorenzo Bettini

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Integration with the Eclipse build mechanism

It is time to see our generator in action: launch Eclipse, create a Java project in the workspace, and, in the src folder, create a new .entities file (remember to accept to add the Xtext nature to the project, otherwise the generator will not run). Continue by adding one or more entities with some attributes. Notice that a src-gen folder is automatically created as soon as you save the file. At this point, you should also add this generated folder to the projects source folders by going to Build Path | Use as Source Folder. Exploring the content of the src-gen folder you will find a generated Java class for each entity in your .entities file. You can see an example in the following screenshot.

Note ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required