Menu

About the CodeGen Builder

FX89

About the Builder

The builder is an application of reduced syntax processing. For CodeGen Builder, reduced syntax applies to the definition of the data model of a given application. The definition should be minimal, meaning:
- no unnecessary type declaration
- no unnecessary specification of parent-child relations
- no need to provide information on cardinality
- no explicit size constraints
- no noise (i.e. brackets, comas, other separators)

Follow this link to learn more about the minimal definition
.
.
.
There are three types of inputs to the builder.

The data model
The data model defines the data structures used by the application.

The REGEX dictionaries
In the CodeGen project, REGEX dictionaries are used for a variety of tasks, including primitive type detection, translation of primitive types into language-specific types and the conjugatuion of nouns for re-factoring purposes. Simply put, REGEX dictionaries are property files (maps) which have regular expressions for keys and / or values. Follow this link to download the regex dictionaries

The template project
The template project defines the deliverables to be generated based on the data model. This includes the directory structure of the end product. The template project also contains the templates which will be used in order to build each type of deliverable.

Follow this link to learn more about template projects


How the builder works

The CodeGen projects has two major components.

The builder
The builder is responsible for the loading of the template project and for the end-to-end code generation workflow.

The generator
The generator is a wrapper for the CodeGen project, which provides lower-level objects which can be wired together to generate content in a variety of ways. Follow this link for more details about the content of the generator project
.
.
.
The following diagram is a high level representation of the code generation workflow.


The automatic enrichment of the inputted data model occurs at the pre-processing phase. This section provides a brief description of the major pre-processing steps in the code generation workflow.

Type detection
Detecting nodes with primitive data types and assigning the proper primitive data types by making use of REGEX dictionaries.

Corelation
Detecting parent-child relationships between the defined entities. Detecting cardinality.

Classification
Nodes are classified by a number of criteria. For instance, repository entities vs bulk entities.

Verification
Verifies that every node in the model has either a primitive type or a type node.

Groups detection
Enriches each node with a number of groups of sub-nodes, including nodes with similar types and nodes with similar names (i.e. "start date" and "end date"), lists of unique type nodes, etc.

Refactoring
Provides a number of refactored names to each node. This includes language-specific type names and singular/plural names re-factoring.


This section provides a brief description of the major post-processing steps in the code generation workflow.

Names refactoring
Once the generation phase is completed, the generated content will be available in the form of a map, having the name as key and the content as value. This step refers to re-factoring the keys of the content map.

Wildcards replacement
Replaces wildcards within the keys an values of the aforementioned content map with statically-defined values, values defined in the template project's properties or parameters provided by the user.


Implementation

The builder is a multi-layered Java application. The following diagram represents the structure of the builder application.

This section provides a brief description of the modules defined in the previous diagram.

codegen-builder-console
Responsible for validating and interpreting user parameters, initialzing and running the codegen-builder-project-wrapper and for reporting errors.

codegen-builder-project-wrapper
Facade for the codegen-builder-project module.

codegen-builder-project
Provides objects which are wired together by the codegen-builder-project-wrapper to run the green builder workflow described in the previous section.

codegen-wrapper
Facade for the codegen project.

codegen
provides lower-level objects which can be wired together by the codegen-wrapper to run the blue generator workflow described in the previous section. More details may be found here.

Follow this link to the JavaDoc.