Java Code Generator

Description

I wouldn't like to build a tool that could only do what I had been able to imagine for it.
— Bjarne Stroustrup

This project aims to provide a plug-in (ch.sahits.codegen.java) for the Eclipse IDE to generate code artefacts (Wizard). When the project started in January 2008 it set out to generate Java source files that were based on a database table structure. In the meantime it can do much more. It can even produce artefacts that we (the developers) have no clue of (as long as you do).

It is highly flexible concerning the in- and output. This is achieved by a highly configurable architecture with templates. A simple scenario is to generate a Bean class for some database tables.
The process breaks down into two parts:

  1. Analysing the input: The form of the input can be virtually anything, e.g. the physical database table or the create script for the table. This input is parsed and stored in a XML file. Some input methods are supplied by the plug-in, others are for custom extensions. Based on the kind of further processing the generated XML file or the underlining datamodel or its representation as an object will be used.
  2. Code generation: There are several ways to go about:
    1. Generating the java-class with a JET transformation based on the input XML generated above.
    2. Generate an abstract syntax tree based on a reference implementation with the input model combined.

The plug-in stands under the Eclipse Public License - v 1.0.

For this application to work you will need to run your Eclipse with at least JVM 1.5 and Eclipse 3.2.

ToDos

Documentation.

There are also some statistics of the svn.

Download

The current version can be downloaded from SourceForge.net. There are also all the older versions available. There is also an update site you can add to the update manager: http://www.sahits.ch/project/javacodegen/update/

Since the plugin uses Java Emitter templates which are a part of the EMF codegen project there is a dependency there.

Changelog

Initial Release 0.9.0

0.9.1

0.9.2

0.9.3

0.9.4

0.9.5

1.0.0

1.1.0

1.1.1

2.0.0

2.1.0, A detailed changelog can be found here

Support

If you find a bug or have a feature request please file a report at SourceForge.net

To get properly started you can read the Tutorial. The Feature Matrix may be another good point to gain an overview.

The following resources will also help you in the process to get started. They are all included in the source distribution of the plug-in.

The followings are video tutorials on how to set up Eclipse for developing extensions and to simple generate code with the plug-in. The tutorials are based on the version 2.0.0. If the tutorials are to fast, hit the pause button.

How to install Eclipse RCP

How to setup the needed additional plug-ins

How to install the Code-Generator

How to get the sources of the plug-ins as Eclipse projects

Walkthough Java Code Generator, the DTP connection mask

Generate with JETemplate, JETemplate and AST, JETGeneration, JETGeneration with AST and Reference implementation, AST Generation

Walkthrough General Code Generator

Walkthrough Multiple-Code Generator

For generating of PHP classes follow the article in the Blog entry. The article uses this templated that is based on the XML Schema. For the produced PHP class to work properly the utility classes of MySQLDAO are needed.

Further support can be obtained by email.

How to get started

This plug-in provides you with a starting point for you to generate your own classes. But this is just the begining. Either you can supply your own templates and generators to fullfill your needs or you can get involved in the community and contibute to this plugin. Either way you will want deeper knowledge that is provided on a separate page.

This Project is hosted at:
SourceForge.net Logo

Last modified: