GithubHelp home page GithubHelp logo

mencl / jiowa-codegen Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 4.61 MB

JIOWA Code Generation Framework: efficient template engine & code generation capabilities

Home Page: http://www.jiowa.de/download.html

jiowa-codegen's Introduction

Download jiowa-codegen

A new approach for code generation is presented. It consists of a powerful template engine which works quite differently from other approaches.

Templates are pre-compiled during automatic build of the IDE into so-called template beans (POJOs). By design, application logic is written in user-defined Java code which uses template beans for the data insertion process. Each template bean can render its contents to a text string by simply calling the toString()-method. If previously generated source files have to be updated, the code generation framework also offers support for protected regions which leave manually written text regions unchanged.

In the following, we list some of its features and continue with a quick introduction.

Features

Quick Introduction: Letter Example

Below we see a simple example template for a letter or email.

Templates are simple text files which can be enriched with template notation elements in order to work with placeholders.

There are only two basic structures for placeholders: variables and subtemplates. In the example letter, inline subtemplates are used, a special case of subtemplates. The red template notation elements are symbols only. There are no special keywords. The green identifiers can be chosen arbitrarily by the user.

The template is compiled during the automatic build process into a so-called template bean. The green text elements of the template become nested structures (classes, constants, ...) within the template bean class.

Parameters can be simply filled into the template bean as shown in the lower left part of the next picture. The text representation of the template bean Letter_jgt delivers the template text with inserted parameter values ("Smith", "Jenny Jones") and sub template instances (Mr, Ms). The text representation of sub template Mr via the toString()-method is "Mr.".

The output of the toString()-method of template bean Letter_jgt is shown in the lower right of the picture below.

Quick Introduction: Java Class Template

The next example shows a Java class template which uses two additional sub templates: Attribute.jgt & GetterSetter.jgt.

The sub template structure identifiers like "foreachAttribute" can be chosen by the template designer totally arbitrarily. It does not matter if we write "pourChaqueElement" (french) or "fuerJedesAttribut" (german), or separate the single words with spaces as in "for each attribute". This identifier is always compiled into the corresponding structure within the template bean with the same name and can be used for the (multiple) insertion of subtemplate instances.

The picture below depicts the translation of the Java class template into the template bean class via automatic build of your IDE.

The attribute template Attribute.jgt is rather short and consists of only two variable values: DataType, AttributeName.

Getters and Setters are defined in the GetterSetter.jgt template which is compiled into the template bean class GetterSetter_jgt.

Insertion of values into the Java class template is performed in the same way as in the letter template example. The type of model from which the data is obtained to be inserted into the template beans is totally arbitrary.

All features are described in the tutorial and handbook...

Tutorial & Handbook

Click here for the Slideshare presentation and here for the PDF version of the handbook.

Download

The distribution consists of a Maven project with an example for a code generation application, generator templates, and the PDF version of the Tutorial & Handbook. The project has been slightly optimized for Eclipse IDE so that the template beans are automatically re-generated if a template or its properties change. For IntelliJ IDEA and Netbeans IDE you will have to hit the re-build button.

Download the code generation framework here ...

You might also want to have a look at the README file of the distribution.

Java Doc: www.jiowa.de/jiowa-codegen/doc/api/

License

JIOWA Code Generation Framework is free for commercial and non-commercial purposes and licensed under the JIOWA Backlinking License 1.0 which basically means that you have to set a backlink to the JIOWA homepage. That's all!

jiowa-codegen's People

Contributors

mencl avatar

Stargazers

Aymen Marouani avatar Marcello Corleone avatar  avatar

Watchers

James Cloos avatar Marcello Corleone avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.