| Free tutorials for Java, Eclipse and Web programming |
Version 0.2
Copyright © 2009 Lars Vogel
02.12.2009
| Revision History | ||
|---|---|---|
| Revision 0.1 | 02.08.2009 | Lars Vogel |
| Splitted of from http://www.vogella.de/articles/EclipseEMF/article.html | ||
| Revision 0.2 | 02.12.2009 | Lars Vogel |
| Fixed missing headline | ||
Table of Contents
EMF contains JET an engine which can generated any kind of output based on the model, e.g. SQL, Java, XML, Text, HTML, etc. JET uses a template technology which is very closely related to the Syntax of Java Server Pages (JSPs).
In JET you define templates. These templates will be used to create Java Implementation classes. This process step is called "translation" .
The Java classes can then be used to create the final output, e.g. a HTML file. This generated class can be initialized and will create the desired result as a String with the method "generate()". This process step is called "generation"
This process is analog to JSPs. The JSP template is also converted into a class (servlet); the servlet then creates the desired output and returns it to the browser.
JET has three different types of expressions, e.g. directives, expressions and scriplets. Scriplets are started with <% and ended with %> and can contain any java code. Expressions allow to insert string values within the JET output and the directives defines the settings for the JET template.
The JET compiler creates a Java source file for each JET. The suggestion for the JET templates is to use the following naming schema: ClassName.outputsuffixjet, whereby the outputsuffix determins the output, e.g. java for Java Source or html for HTML files.
The following will use the webpage example created in Eclipse EMF Tutorial . Please make sure you have create the EMF model described in this article.