Hello world tutorial in java

Design a simple UML model

Let's create 3 simple classes. I'll generate the code in Java language as it is the one I know best :

Create one java template

Now, let's code your first template, made of 2 files :




package ${c.owner.getFullyQualifiedName(".")};
* This class was generated automatically thanks to any

public class ${c.name} {
	<% c.attributes.each { %>
	<% } %>
	<% c.attributes.each { %>
	<% } %>
	<% c.attributes.each { %>
	<% } %>

You may have noticed 'java' variable. This is a built-in directive . Because Anycode UML API can sometimes be difficult to use, boilerplate code is added to directives so that you only have to focus on your custom code generation.

Generate your java code

Once both files are saved in a directory (let's say "template" directory), you can call the plugin, as shown below :

Finally, look at the target directory. Done !