2.2. T01 Hello World

In this tutorial we will build a simple ‘Hello World’ application with MetaFactory.

In the directory metafactory-workshop-metafactory\src\patterns, add an xml file named hello-world.xml with this content:

Listing 2.6 hello-world.xml
 1<package xmlns="http://www.firstbase.nl/xsd/personaliom/pattern"
 2         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 3         xsi:schemaLocation="http://www.firstbase.nl/xsd/personaliom/pattern http://www.firstbase.nl/xsd/personaliom/pattern.xsd"
 4         name="com.company.workshop"
 5         path="src/main/java"
 6         package="domain">
 7  <class name="HelloWorld">
 8    <operation name="main" static="true">
 9      <parameter name="args"><datatype>String[]</datatype></parameter>
10      <body>
11        // just output Hello World
12        System.out.println("Hello World");
13      </body>
14    </operation>
15  </class>
16</package>

Now:

  • Click on metafactory-workshop-metafactory in the MetaFactory Project window.

  • Click on the Play button to run the MetaFactory machine.

Once finished MetaFactory will have generated the Java class HelloWorld.

../_images/generate-hello-world-screenshot.png