== Java Generation  ==

The goal of the Java Generation plug-in is to allow Java code generation from a Java model. Such a generation will fulfill some of the requirements for Legacy refactoring and migration. 

''Quality disclaimer: this generator is provided without any guarantee.''

=== Description  ===

[[Image:../../img/JavaM2T.PNG|frame|center]] 

This plug-in proposes Acceleo modules for generating Java files conforming to Java models. Templates are contained in two modules 

*Structures modules top level templates for generating classes/method/field declarations 
*Statements modules

Java models are obtained with the [../java_discoverer/user.html Java Discoverer] component. 

Considering a Java legacy, a minimal migration/refactoring chain will involve 

*A Java model discovery step 
*A M2M transformation step 
*A Java generation code step with the current component

=== User manual  ===

A prerequisite is a Java model. Please refer to the [../java_discoverer/user.html  Java Discoverer] user manual. 

To launch a Java generation, add ''org.eclipse.gmt.modisco.java.generation'' in your plugin dependencies and use the ''GenerateJavaExtended'' main method with input model and target folder as parameters. The code should look like this :
<pre>
GenerateJavaExtended javaGenerator = new GenerateJavaExtended(URI.createFileURI("C:/.../my.javaxmi"),
    new File("C:/.../myOutputFolder"), new ArrayList<Object>());
javaGenerator.doGenerate(null);
</pre>

Note : at the moment this documentation is written, there is no way of creating one Acceleo Launch Configuration based on one installed Acceleo module plugin.
