Generated Code.

h2zero takes the drudgery out of hand crafting code by automatically generating a swathe of artifacts that ensure consistency throughout the code base.

The following options are available (found in the synapticloop.h2zero.model.Options.java)

public static final String OPTION_JAVA = "java";
public static final String OPTION_SQL = "sql";
public static final String OPTION_REPORTS = "reports";

private static HashSet<String> ALLOWABLE_GENERATORS = new HashSet<String>();
static {
	ALLOWABLE_GENERATORS.add(OPTION_SQL);
	ALLOWABLE_GENERATORS.add(OPTION_JAVA);
	ALLOWABLE_GENERATORS.add(OPTION_REPORTS);
}

h2zero generates a lot of boilerplate code for you and places it in the following output directories:

/src
  /main
     /java
          </your/package/here>
                            /bean
                            /counter
                            /deleter
                            /finder
                            /inserter
                            /model
                            /question
                            /taglib
                            /updater
    /sql/create-database.sql
    /webapps/WEB-INF/tld/<your.schema.name.tld>

/src/main/java/</your/package/here>

This is where the majority of the code will be generated to, </your/package/here> is the java packaging and directory structure as defined in the .h2zero file. In the example file, the package is defined as:

"package": "synapticloop.sample.h2zero"

Which is a key under the database JSONobject.

It is recommended that the package is namespaced with a .h2zero as the last hierarchy to separate out the generated code.

This will generate code that goes into the the following directory

/src/main/java/synapticloop/sample/h2zero

The /bean directory

The bean directory contains all of the code that is generated for the selectClause key. The beans are a sub-set of the fields from one or more tables.

Code is only generated if there is a selectClause generated for any of the beans.

The /counter directory

The counter directory contains all of the code that is generated for the counters key.

The /deleter directory

The deleter directory contains all of the code that is generated for the deleters key.

The /finder directory

The finder directory contains all of the code that is generated for the finders key.

The /inserter directory

The inserter directory contains all of the code that is generated for the inserters key.

The /model directory

The model directory contains all of the code that is generated for the model key. The model is a POJO

The /question directory

The question directory contains all of the code that is generated for the questions key.

The /taglib directory

The taglib directory contains all of the code that is generated for the taglib key.

Within this directory are sub-directories of all of the table objects, with their individual tags.

The /updater directory

The updater directory contains all of the code that is generated for the updaters key.

Option code generation

OptionGenerated codenotes
javaGenerate the model beansAutomatically generate the POJOs for the tables, including finders, deleters, inserters, etc.
sqlGenerate the database cration scriptAutomatically generate the SQL database creation script and any constants table inserters as well.
taglibTag libraries for finders, counters and questionsThis has been removed - this is now part of the extensions. Automatically generated for each of the SQL interactors, this will also automatically generate the correct tag library desciptor (tld) file.