ch.sahits.codegen.wizards
Class DynamicDBGenerationCode

java.lang.Object
  extended by ch.sahits.codegen.wizards.DynamicDBGenerationCode

public final class DynamicDBGenerationCode
extends java.lang.Object

This class defines the ways the input data is retrieved. There are some ways that are implemented and other that can be added through extension points.

Since:
1.1.0 TODO use extendable enum see Joshua bloch
Author:
Andi Hotz

Field Summary
static java.lang.String DEFAULT_DB_DEFINITION_PAGE_CLASS_NAME
          Constant hold the name of the default database db definition page
static int WITH_DB_INPUT_FILE
          Generate a class with relation to a database table retrieved from the input file
static int WITHOUT_DB
          Generate a class without any relations to a database e.g.
 
Constructor Summary
DynamicDBGenerationCode()
          Default constructor initializing the empty List
 
Method Summary
 void add(java.lang.String className)
          Add a new value to the list
 int convert2Index(int constant)
          Convert the model constant to the index in the list of the used extensions.
 java.lang.String getClassName(int index)
          Retrieve the class name by the constant value
 int getValue(java.lang.String className)
          Retrieve the value of the Generation code for a given class
 java.util.List<java.lang.Integer> values()
          Retrieve all constant values for the generation Code
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WITHOUT_DB

public static final int WITHOUT_DB
Generate a class without any relations to a database e.g. HelloWorld

See Also:
Constant Field Values

WITH_DB_INPUT_FILE

public static final int WITH_DB_INPUT_FILE
Generate a class with relation to a database table retrieved from the input file

See Also:
Constant Field Values

DEFAULT_DB_DEFINITION_PAGE_CLASS_NAME

public static final java.lang.String DEFAULT_DB_DEFINITION_PAGE_CLASS_NAME
Constant hold the name of the default database db definition page

See Also:
Constant Field Values
Constructor Detail

DynamicDBGenerationCode

public DynamicDBGenerationCode()
Default constructor initializing the empty List

Method Detail

add

public void add(java.lang.String className)
Add a new value to the list

Parameters:
className - name of the class from the extension point ch.sahits.codegen.java.connectionpage

getValue

public int getValue(java.lang.String className)
Retrieve the value of the Generation code for a given class

Parameters:
className - name of the class from the extension point ch.sahits.codegen.java.connectionpage
Returns:
constant value for the class. If the class is not registered the value -1 is returned

values

public java.util.List<java.lang.Integer> values()
Retrieve all constant values for the generation Code

Returns:
List of all values

getClassName

public java.lang.String getClassName(int index)
Retrieve the class name by the constant value

Parameters:
index - value of the constant
Returns:
class name or null if the constant is invalid

convert2Index

public int convert2Index(int constant)
Convert the model constant to the index in the list of the used extensions.
ATTENTION: the index for the first for generation codes must be eleminated by 2 to the right

Parameters:
constant - to be converted
Returns:
index in the extension list or -1 if the index is invalid