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