generj

version 0.1 in download

Overview

A java to java source code generator. Use a fluent java description to generate java source code.
The original idea was to ease the java code generation in stjx. This also the place to look for more examples.

An easy one:

 Clazz hr = new Clazz("org.open.hello", 
                               TYP("HelloWorld")).
                               publc().sttic().method( VOID, "main" ).
                                   arg( Typ.array( "String" ), "args" ).
                                   body().
                                      call( DOT( NAME("System"), NAME("out"), NAME("println")), 
                                             STR("Hello World\\n")).r().c();
 hr.toString();

produces:

package org.open.hello;

public class HelloWorld {

   public static void main( String ... args ){
      System.out.println( "Hello World\n" );
   }
}

Plan

The first releases is targeted for stjx. If anybody is interested in further development generj will develop as independent project.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License