Skip to content

Getting Started

Structure of a Generator

A code generator is made up of a set of transformation steps. There are three types of transformation steps: ‘Model Access’, ‘Model Converter’ and ‘Generation Group’. Typically, you modularize a code generator along the lines of these types of tranformation steps. With this, you end up having four different types of Java modules for your code generator, each located in a separate Eclipse project:

  • Model Access
  • Model Converter
  • Generation Group

The following drawing shows how the transformation steps work in principle:

Additionally, you use a fourth type of Java module: ‘Metamodel’. This Java module type is not related to one specific transformation step. It contains a set of Java beans that is used by more than one of the other types of Java modules.

Virtual Developer APIs

Virtual Developer provides a Java API for each transformation step type:

  • Model Access: classes in
    • org.jenerateit.modelaccess
  • Model Converter: classes in
    • org.jenerateit.modelconverter
  • Generation Group: classes in
    • org.jenerateit.annotation
    • org.jenerateit.generationgroup
    • org.jenerateit.project
    • org.jenerateit.transformation
    • org.jenerateit.writer

For the development of basic code generators it is totally sufficient to use those APIs (like for instance for the “Hello World” generator). For more complex code generators Generative Software provides open source components that provide common functionality that you otherwise would have to program yourself.

The ‘Hello World’ Generator


The hello world generator does not make use of the open source components that are mentioned further above. Its purpose is to highlight the basic Virtual Developer API, that is sufficient for building basic code generators. When it comes to more complex code generators, it is recommended to use the open source components, since they significantly ease your work.

The following picture shows the structure of the “Hello World” generator that uses the VD-APIs. It shows all of the generator’s transformation steps. The picture is taken from the VD-IDE’s genset editor that you use to define and configure a generator’s structure.

The very first node in this tree nominates the generator itself:

The three subsequent nodes nominate the generator’s transformation steps:

  • TextModelAccessProvider
  • TextToGreetingConverterProvider
  • GenerationGroupHelloWorldProvider

There is a more detailed explanation of how the ‘Hello World’ Generator works.

The ‘Hello World’ Generator and some more open source code generators can be found on a public bitbucket repository.